subquery in count sql code example
Example 1: count subquery sql
Select Count(*) from
(
Select id from users
) as userCount
Select * from
(
select count(id) as cnt from Users where LastPasswordChangedDate < '2021-01-01'
) as LastPasswordChangedDate
Select
(
select count(id) as cnt from Users where LastPasswordChangedDate < '2021-01-01'
) as LastPasswordChangedDateCount
, *
from Users
where LastPasswordChangedDate < '2021-01-01'
Example 2: get substract count sql
select Count(City) - Count(Distinct(City)) from Station;