select
mch_nm
from cmb_usr_trx_rcd
where usr_id in ('5201314520', '5211314521') and year(trx_time) = 2024
group by mch_nm
having count(usr_id) = 2
order by mch_nm
select
usr_id,
sum(trx_amt) as total_amt,
(select avg(trx_amt) from cmb_usr_trx_rcd) as platform_avg_amt
from cmb_usr_trx_rcd
group by usr_id
order by total_amt desc;
select
goods_id,
sum(order_gmv) as total_gmv
from order_info
where date(order_time) = '2024-09-10'
group by goods_id
order by sum(order_gmv) desc
limit 10
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(usr_id) 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 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(trx_amt) 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 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(usr_id) as trx_cnt
,min(date(trx_time)) as first_date
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲'
and usr_id='5201314520'
group by trx_amt
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.others'
end as ser_typ
,count(usr_id) as trx_cnt
,min(date(trx_time)) as first_date
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲'
and usr_id='5201314520'
group by trx_amt
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.others'
end as ser_typ
,count(usr_id) as trx_cnt
,min(date(trx_time)) as first_date
from cmb_usr_trx_rcd
where mch_nm = '红玫瑰按摩保健休闲'
and usr_id='5201314520'
group by trx_amt
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.others'
end as ser_typ
,count(usr_id) 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 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.others'
end as ser_typ
,count(usr_id) 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,
max(score) as max_score,
min(score) as min_score,
avg(score) as avg_score
from scores
where
student_id in ('460093', '735011')
and subject = '数学'
group by
student_id
select
student_id,
subject,
max(score) as max_score,
min(score) as min_score,
avg(score) as avg_score
from scores
where student_id = '735011'
and subject = '语文'