[selectRecords] select to_char(to_date(uh.syori_ymd, 'YYYYMMDD'), 'yyyy/mm/dd') as syori_ymd, count(distinct uh.den_no) as den_cnt, sum((case when (uh.cash_flg = 0 and mt.tori_kbn = '1') then uh.zeinuki_gaku end)) as kakeuri_sum,--掛売上:売上Hの現金FLG=0 かつ 得意先Mの取引区分=売掛 sum((case when (uh.cash_flg = 1 ) then uh.zeinuki_gaku end)) as genkin_sum,--現金売上:売上Hの現金FLG=1 sum((case when (uh.cash_flg = 0 and mt.tori_kbn = '0' ) then uh.zeinuki_gaku end)) as tsudo_sum,--都度請求:売上Hの現金FLG=0 かつ 得意先Mの取引区分=通常 sum(uh.zeinuki_gaku) as kingaku, sum(uh.zeikomi_gaku) as zeikomi_gaku, sum(uh.zei_gaku) as zei_gaku, sum(uh.genka_gaku) as genka_gaku, sum(uh.zeinuki_gaku - uh.genka_gaku) as arari from t_uri uh left join m_tokui mt on (uh.tok_cd = mt.tok_cd ) left join m_hanyo han on (han.mst_kbn = '01' and han.han_cd = uh.prc_sts) where 1=1 and uh.del_flg = 0 and uh.jucyu_flg <> '1' and coalesce(han.koumoku3, '') = '' and (uh.tok_cd >= '&20' or '' = '&20') and (uh.tok_cd <= '&21' or '' = '&21') and (uh.eigyou_tan_cd >= '&24' or '' = '&24') and (uh.eigyou_tan_cd <= '&25' or '' = '&25') and (uh.syori_ymd >= '&16' or '' = '&16') and (uh.syori_ymd <= '&17' or '' = '&17') group by uh.syori_ymd order by uh.syori_ymd /* select t.nyukin_no ,to_date(t.nyukin_ymd, 'YYYYMMDD') as nyukin_ymd , t.total_gaku, t.nyukin_gaku , t.tok_cd, tk.tok_nm , t.tan_cd, tan.tan_nm , t.nyukin_kbn, han.han_name , to_date(t.tegata_ymd, 'YYYYMMDD') as tegata_ymd , t.tegata_no, t.biko , t.tesuryo, t.cyosei_gaku , to_char(t.cre_time,'yyyy/mm/dd') as cre_time , to_char(t.upd_time,'yyyy/mm/dd') as upd_time from t_nyukin t left join m_tokui tk on tk.tok_cd = t.tok_cd left join m_tanto tan on (tan.tan_cd = t.tan_cd) left join m_hanyo han on (t.nyukin_kbn = han.han_cd and mst_kbn = '13') where 1 = 1 and t.del_flg= 0 and (t.nyukin_ymd >= '&1' or '' = '&1') and (t.nyukin_ymd <= '&2' or '' = '&2') and (t.tok_cd >= '&3' or '' = '&3') and (t.tok_cd <= '&4' or '' = '&4') and (t.tan_cd >= '&5' or '' = '&5') and (t.tan_cd <= '&6' or '' = '&6') order by t.nyukin_ymd,t.nyukin_no ; */