안녕하십니까?
각각의 카운트의 구하고 그 합을 구하려고 합니다.
1 2 3 4 5 6 7 | SELECT tp_id , COUNT (*) cntall , COUNT ( CASE WHEN tf_sorter = 'N' THEN 1 END ) cntown , ( select count (tp_id) FROM template a left join template_folder b on a.tp_idfolder = b.tf_id where tf_sorter = 'Y' ) cntpublic FROM template a left join template_folder b on a.tp_idfolder = b.tf_id WHERE b.tf_groupid = '226' ; |
cntown 카운트와 cntpublic 카운트의 합을 cntall에 넣어주려면
어떻게 해야 할까요?