select site_code,date,member_idsum(casewhen type=3 then1else0end) as recharge_times,sum(casewhen type =189 then1else0end) as withdraw_timesfrom st_member_reportwhere 1=1 group by site_code,date,member_id