[selectRecords]
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
, (case when(t.tegata_ymd != '')then(to_date(t.tegata_ymd, 'YYYYMMDD'))else(null)end) 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




