我在支持工作,我试图计算有多少“案例”同时应用了这两个标签:
“聊天”和“升级”
这是我正在使用的查询,但我得到的数字不正确:
select count(pk_case_number)
from cases c
join labels l
on l.case_number = c.case_number
where lower(label_name) = 'chat'
and exists (select distinct case_number
from cases c
join labels l
on on l.case_number = c.case_number
where l.case_number = c.case_number
and lower(label_name) = 'escalated')
and date(created_at) > '2013-08-11'
“created_at”在案例表中。