Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
id | some | noone | 1 | 1 | 0 2 | 1 | 1 3 | 1 | 0
SELECT distinct COUNT(*) OVER () as TotalSome, sp.Id FROM table sp WHERE Some = 1 and Noone = 1
select count(some) from table where some=1 and noone=1;
id | some | noone | 1 | 1 | 0 2 | 1 | 1 3 | 1 | 0 4 | 0 | 1
SELECT (SELECT COUNT(*) FROM sp WHERE ([some] = 1)) AS SomeCount, (SELECT COUNT(*) FROM sp WHERE ([some] = 1) AND (noone = 1)) AS NooneCount
SELECT SUM(some), SUM(some * noone) FROM table