EmployeeA:
E_no E_name E_Ag_ref E_Type Status E_Entry_Date
----------------------------------------------------------------
1B Mike 12345 B Continued 08/01/2013 12:24:20
1S steve 12345 S Continued 08/01/2013 12:25:20
2B Radek 1001 B Continued 08/01/2013 16:24:20
2S Rafal 1001 S nContinued 06/01/2014 20:24:20
クエリ:
select *
from
Employee E1,
Employee E2
where
((substr(E1.E_no,1,length(E1.E_no)-1) || 'S')=E2.E_no and E2.E_Type='S' )
and ( ( TO_CHAR(E1.E_Entry_Date,'YYYYMMDD HH24:MI:SS') ) between ((:startDate)||' '|| (:startTime)) and ((:endDate)||' '||(:endTime)) OR ('ALL' between (:startTime) and (:endTime)) )
and ( ( TO_CHAR(E2.E_Entry_Date,'YYYYMMDD HH24:MI:SS') ) between ((:startDate)||' '|| (:startTime)) and ((:endDate)||' '||(:endTime)) OR ('ALL' between (:startTime) and (:endTime)) )
and E2.E_Type='B' and E1.status='Continued' and E2.status='Continued'
上記のクエリは3レコード未満を返します。
1B Mike 12345 B Continued 08/01/2013 12:24:20
1S steve 12345 S Continued 08/01/2013 12:25:20
2B Radek 1001 B Continued 08/01/2013 16:24:20
入力パラメータ:
startDate:06/01/2012
endDate: 08/01/2013
startTime: 13:00:00
endTIme: 21:00:00
期待される結果:
1B Mike 12345 B Continued 08/01/2013 12:24:20
誰かがこれを修正する方法を提案できますか?
よろしく、コマツリ