select
city,
round(sum(case when con regexp '雪' then '1' else '0' end), 2) as snowy_days
from weather_rcd_china
where month(dt) in(12, 01, 02)
group by city
order by snowy_days desc
select
city,
sum(case when con regexp '雪' then '1' else '0' end) as snowy_days
from weather_rcd_china
where month(dt) in(12, 01, 02)
group by city
order by snowy_days desc
select sum(timestampdiff(second, call_time, grab_time)) / count(1) as avg_response_time_seconds
from didi_order_rcd
where grab_time != '1970-01-01 00:00:00'
select
city,
sum(
case when con regexp '多云' then '1'
else '0' end) as cloudy_days,
concat(
format(
sum(case when con regexp '多云' then '1' else '0' end)
/ count(*) * 100,2) , '%')as p
from weather_rcd_china
where year(dt) = 2021
group by city
order by p desc
select
city,
sum(
case when con regexp '多云' then '1'
else '0' end) as cloudy_days,
concat(
format(
sum(case when con regexp '多云' then '1' else '0' end)
/ count(*) * 100,2) , '%')as p
from weather_rcd_china
where year(dt) = 2021
group by city
select
city,
sum(
case when con regexp '多云' then '1'
else '0' end) as cloudy_days,
concat(round(sum(
case when con regexp '多云' then '1'
else '0' end) / count(*),4) * 100, '%')as p
from weather_rcd_china
where year(dt) = 2021
group by city
select
city,
sum(
case when con regexp '多云' then '1'
else '0' end) as cloudy_days,
round(sum(
case when con regexp '多云' then '1'
else '0' end) / count(*),4) * 100as p
from weather_rcd_china
where year(dt) = 2021
group by city
select
case when trx_amt = 288 then '1.WithHand'
when trx_amt = 388 then '2.WithMimi'
when trx_amt = 588 then '3.BlowJobbie'
when trx_amt = 888 then '4.Doi'
when trx_amt = 1288 then'5.DoubleFly'
else '6.other'
end as ser_typ,
count(*) as trx_cnt,
min(date(trx_time)) as first_date
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲' and usr_id = '5201314520'
group by ser_typ
order by ser_typ
select
case when trx_amt=288 then '1.WithHand'
when trx_amt=388 then '2.WithMimi'
when trx_amt=588 then '3.BlowJobbie'
when trx_amt=888 then '4.Doi'
when trx_amt=1288 then '5.DoubleFly'
else '6.other'
end as ser_typ
,count(1) as trx_cnt
,min(date(trx_time)) as first_date
from
cmb_usr_trx_rcd
where usr_id='5201314520' and mch_nm='红玫瑰按摩保健休闲'
group by ser_typ
order by 1
select
case when trx_amt = 288 then '1.Withhand'
when trx_amt = 388 then '2.WithMimi'
when trx_amt = 588 then '3.BlowJobbie'
when trx_amt = 888 then '4.Doi'
when trx_amt = 1288 then'5.DoubleFly'
else '6.other'
end as ser_typ,
count(*) as trx_cnt,
min(date(trx_time)) as first_date
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲' and usr_id = '5201314520'
group by ser_typ
order by ser_typ
select
case when trx_amt = 288 then '1.Withhand'
when trx_amt = 388 then '2.WithMimi'
when trx_amt = 588 then '3.BlowJobbie'
when trx_amt = 888 then '4.Doi'
when trx_amt = 1288 then'5.DoubleFly'
else '6.Other'
end as ser_typ,
count(*) as trx_cnt,
min(date(trx_time)) as first_date
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲' and usr_id = '5201314520'
group by ser_typ
order by ser_typ
select
case when trx_amt = 288 then '1.Withhand'
when trx_amt = 388 then '2.WithMimi'
when trx_amt = 588 then '3.BlowJobbie'
when trx_amt = 888 then '4.Doi'
else '5.DoubleFly'
end as ser_typ,
count(*) as trx_cnt,
min(date(trx_time)) as first_date
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲' and usr_id = '5201314520'
group by ser_typ
order by ser_typ
select student_id, sum(score) as total_score
from scores
where subject in ('语文', '数学', '英语') and exam_date = '2024-06-30'
group by student_id
having total_score > 330