我有一个查询,我必须从一个表中查看 3 列,其中我在 message 列上搜索了 2 列,最后一列应该在 like 上。我怎样才能同时使用这两个语句。
SELECT date(datetime) as dateonly ,
sum(CASE message when 'Accepted Images' then 1 else 0 end) as AcceptedIMG,
sum(CASE message when 'Rejected Images' then 1 else 0 end) as RejectedIMG,
sum(CASE when message like '%Changed to %' then 1 else 0 end) as ChangeIMG
FROM customer_1.audit_trail
WHERE message like ('%Changed to %') and message in ('Accepted Images','Rejected Images')
GROUP BY (dateonly)
ORDER BY (dateonly) asc ;