티스토리 뷰

공부

[SQL] Count by condition

승가비 2019. 12. 22. 00:15
728x90
select count(case Position when 'Manager' then 1 else null end)
from ...

select sum(case Position when 'Manager' then 1 else 0 end)
from ...

[출처] https://stackoverflow.com/questions/1400078/is-it-possible-to-specify-condition-in-count

728x90

'공부' 카테고리의 다른 글

[Linux] Encoding 깨질때  (0) 2020.01.18
[FTP] command  (0) 2019.12.22
[JS] VueJS bind scroll event  (0) 2019.12.22
[JS] Browser get scroll direction  (0) 2019.12.22
[Git] How do I get the commit count?  (0) 2019.12.22
댓글