by shigemk2

当面は技術的なことしか書かない

条件結果のcount distinct

こういうかんじで条件式の結果をcount distinctできる

select
  count(distinct tag) as tag_count,
  count(distinct (case when entryId > 0 then tag end)) as positive_tag_count
from
  your_table_name;

sql - COUNT DISTINCT with CONDITIONS - Stack Overflow