Answers for "sql count subquery where"

SQL
2

count subquery sql

/*count sub query
Depends on the use case, here are a few options*/

Select Count(*) from 
(
--Sub query
Select id from users 
) as userCount

Select * from 
(
--Sub query
select count(id) as cnt from Users where LastPasswordChangedDate < '2021-01-01'
) as LastPasswordChangedDate

Select 
(
	--Sub query
	select count(id) as cnt from Users where LastPasswordChangedDate < '2021-01-01'
) as LastPasswordChangedDateCount
, *
from Users
where LastPasswordChangedDate < '2021-01-01'
Posted by: Guest on April-08-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language