When using BETWEEN against date values where the date is time specific (ie not just 00.00.00) rows are excluded for the end date if they are timed past midnight (ie 00.00.01 and onwards).
Please see specific example with "Good" and "Bad" situations:
GOOD:
select creation_date from ifsapp.person_info_tab
where creation_date between to_date('&Start_Date','DD/MM/YYYY')
and to_date('&End_Date','DD/MM/YYYY')
for 19/07/2004 and 20/07/2004
Creation_Date
2004-07-19-00.00.00
2004-07-19-00.00.00
2004-07-19-00.00.00
2004-07-19-00.00.00
2004-07-20-00.00.00
2004-07-20-00.00.00
BAD:
select dated from ifsapp.inventory_transaction_hist2
where dated between to_date('&Start_Date','DD/MM/YYYY')
and to_date('&End_Date','DD/MM/YYYY')
for 19/07/2004 and 20/07/2004
Dated
2004-07-19-06.10.01
2004-07-19-06.10.02
2004-07-19-06.10.02
2004-07-19-06.10.03
2004-07-19-06.10.03
2004-07-19-06.10.03
2004-07-19-06.10.03
2004-07-19-06.10.03
2004-07-19-06.15.34
.
.
.
2004-07-19-22.08.41
2004-07-19-22.08.41
2004-07-19-22.08.41
2004-07-19-22.08.43
2004-07-19-22.08.43
2004-07-19-22.08.43
2004-07-19-22.08.43
What is the suggested method for dealing with this, can one code the SQL to default the todate to "23:59:59" ?
There's no need for sarcastic replies, we've not all been this sad for that long!
Please see specific example with "Good" and "Bad" situations:
GOOD:
select creation_date from ifsapp.person_info_tab
where creation_date between to_date('&Start_Date','DD/MM/YYYY')
and to_date('&End_Date','DD/MM/YYYY')
for 19/07/2004 and 20/07/2004
Creation_Date
2004-07-19-00.00.00
2004-07-19-00.00.00
2004-07-19-00.00.00
2004-07-19-00.00.00
2004-07-20-00.00.00
2004-07-20-00.00.00
BAD:
select dated from ifsapp.inventory_transaction_hist2
where dated between to_date('&Start_Date','DD/MM/YYYY')
and to_date('&End_Date','DD/MM/YYYY')
for 19/07/2004 and 20/07/2004
Dated
2004-07-19-06.10.01
2004-07-19-06.10.02
2004-07-19-06.10.02
2004-07-19-06.10.03
2004-07-19-06.10.03
2004-07-19-06.10.03
2004-07-19-06.10.03
2004-07-19-06.10.03
2004-07-19-06.15.34
.
.
.
2004-07-19-22.08.41
2004-07-19-22.08.41
2004-07-19-22.08.41
2004-07-19-22.08.43
2004-07-19-22.08.43
2004-07-19-22.08.43
2004-07-19-22.08.43
What is the suggested method for dealing with this, can one code the SQL to default the todate to "23:59:59" ?
There's no need for sarcastic replies, we've not all been this sad for that long!