Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

missing date selection

Status
Not open for further replies.

mdarsot

Instructor
Apr 13, 2006
86
CA
Hi everyone

when i run below query it is not selection data for Feb 28 even though my scrpt says less then equal to. Any help

select
substr(output_svycode_NM,1,2) as SI,
SUM(PROCESSING_BATCHSIZE_QTY) AS LOADS,
to_char(batch_release_dt,'IW') WK
from
PARTS_DATABSE
where
(OUTPUT_SVYCODE_NM like '29%')
and batch_release_dt >='02-FEB-09'
and batch_release_dt <='28-FEB-09'
group by
substr(OUTPUT_SVYCODE_NM,1,2),
to_char(batch_release_dt,'IW')
 
MDarsot,

Every second on February 28 (except for 00:00:00) is outside the results set you requested...Isn't '28-FEB-09' at '00:01:23' outside the result set?

What you probably want to say is either:
Code:
...
where
        (OUTPUT_SVYCODE_NM like '29%')
        and trunc(batch_release_dt) >='02-FEB-09'
        and trunc(batch_release_dt) <='28-FEB-09'
...or...
Code:
...
where
        (OUTPUT_SVYCODE_NM like '29%')
        and batch_release_dt >='02-FEB-09'
        and batch_release_dt < '01-MAR-09'
Let us know your thoughts on this issue.



[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”
 
Great thanks for the help. i use the #1 trunc option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top