Answers for "using count as subquery sql"

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
0

get substract count sql

select  Count(City) - Count(Distinct(City)) from Station;
Posted by: Guest on January-22-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language