我要计算特定的计数总和
select is_known_bot, count(*)
FROM "public"."bus_request"
where app_name = 'xxxxxx' and event_type <> 'browser_js'
and is_known_bot <>''
and date <= GETDATE() and date>= GETDATE()-14
group by is_known_bot
order by is_known_bot asc
我得到下表:
is_known_bot count
good 2
bad 3
Human 7
最后,我想获得下表:
is_known_bot count
bot 5
Human 7
答案 0 :(得分:1)
您可以使用CASE
代替列is_know_bot
Case when is_know_bot = 'Human' then is_know_bot else 'Bot' end