我做啦~我只会这一道!!!
不过没有截图。。大概回忆了一下
如果有大佬发现不对欢迎指教!
大概是
select id,
sum(case when category='hotel' then 1 else 0 end) as hotel,
sum(case when category=flight' then 1 else 0 end) as flight,
avg(amount)
from detail
where substr(orderdate,1,4)='2019'
group by id
order by id