select date(trx_time) as trx_date,
max(trx_amt),
min(trx_amt),
avg(trx_amt),
sum(trx_amt)
from cmb_usr_trx_rcd
where mch_nm='红玫瑰按摩保健休闲'
and date(trx_time) between '20240901' and '20240930'
group by date(trx_time)
order by date(trx_time);
select mch_nm,sum(trx_amt) as sum_trx_amt
from cmb_usr_trx_rcd
where usr_id='5201314520'
and year(trx_time)=2024
group by mch_nm
order by sum_trx_amt desc;
select * from cmb_usr_trx_rcd
where date(trx_time) between '2024-09-01' and '2024-09-30'
and usr_id='5201314520'
and (hour(trx_time) >=22 or hour(trx_time) <=5)
order by trx_time;
select * from cmb_usr_trx_rcd
where date(trx_time) between '2024-09-01' and '2024-09-30'
and usr_id='5201314520'
and (hour(trx_time) >=22 or hour(trx_time) <=5);
select * from cmb_usr_trx_rcd
where date(trx_time) between '2024-09-01' and '2024-09-30'
and usr_id='5201314520'
and hour(trx_time) between 1 and 5
order by trx_time;