# 查帳SQL ###### tags: `W1維護` 查PG遊戲明細 ```sql! select count(*), sum(winamount)-sum(betamount)as netwin from t_pg_bet_record where playername = 'prd2200274896' ``` 查匯總帳 ```sql! select sum(netwin) from t_bet_record_summary where game_id = 'PG' and reportdatetime between '2022-09-26 11:35' and '2022-09-27 18:00' and club_id = (select club_id from t_wallet where club_ename = 'AsPce6006') ``` 查轉入轉出記錄 ```sql! select * from t_wallet_transfer_record where club_id = (select club_id from t_wallet where club_ename = 'Aimh8op999') and create_datetime between '2022-09-26 11:35' and '2022-09-27 18:00' and type = 'PG' --and target = 'RCG' --and source = 'RCG' --order by create_datetime ``` 查AE明細帳 ```sql! select count(*), sum(payout_amt) - sum(bet_amt) as netwin --select count(*) from t_ae_bet_record where completed_at between '2022-10-03 17:50' and '2022-10-03 18:30' --where summary_id = 'b8d0e8f6-3207-4d88-98ae-0103954b285f' and account_name = 'prd2201031015' ``` 查PG明細帳 ```sql! select count(*),sum(winamount-betamount) from t_pg_bet_record where betendtime between '2022-10-03 12:00' and '2022-10-04 12:00' --and playername = 'prd2101195215' ``` 查JDB明細帳 ```sql! select count(*),sum(total) from t_jdb_bet_record tjbr where lastmodifytime between '2022-10-03 12:00' and '2022-10-04 11:59:59.997' --and playerid = '2201458295' ``` 查AE明細帳 ```sql! select count(*),sum(payout_amt-bet_amt) from t_ae_bet_record tjbr where completed_at between '2022-10-03 12:00' and '2022-10-04 12:00' --and account_name = 'prd2201031015' ``` 查DS明細帳 ```sql! select count(*),sum(payout_amount-bet_amount) from t_ds_bet_record tjbr where finish_at between '2022-10-03 12:00' and '2022-10-04 12:00' --and member = '2005769614' ``` 查SABA明細帳 ```sql! select * from t_saba_bet_record where transaction_time between '2022-10-01 00:00:00' and '2022-10-01 08:00:00' --and member = '2005769614' ```