1/*count sub query
2Depends on the use case, here are a few options*/
3
4Select Count(*) from
5(
6--Sub query
7Select id from users
8) as userCount
9
10Select * from
11(
12--Sub query
13select count(id) as cnt from Users where LastPasswordChangedDate < '2021-01-01'
14) as LastPasswordChangedDate
15
16Select
17(
18 --Sub query
19 select count(id) as cnt from Users where LastPasswordChangedDate < '2021-01-01'
20) as LastPasswordChangedDateCount
21, *
22from Users
23where LastPasswordChangedDate < '2021-01-01'