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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Time Problem

Status
Not open for further replies.

timmbo

Programmer
Feb 22, 2001
167
US
Hi All,

This should be easy for you gurus out there. I am trying to get a return dataset based off of time. Say a user enters a beginning time of 09:00 and an ending time of 10:00. I would like to return all records between and including 09:00 and 10:00. Here is the query I'm currently trying to work.

SELECT c.baiDesc, d.amount, d.refNum, d.descr, c.baiType, d.fundsType, d.fundsTypeAmt1,
d.fundsTypeAmt2, d.fundsTypeAmt3, d.fundsTypeDate, detail.baiType, detail.baiDesc
FROM CDR_ACCT_DETAIL d, BAI_TYPE_CODE c, (SELECT baiType, baiDesc FROM BAI_TYPE_CODE WHERE baiLevel = 'Detail') detail
WHERE d.baiType = c.baiType
AND detail.baiType = d.baiDetailType
AND d.acctNum = '8400000000'
AND TRUNC(d.asofDate) BETWEEN to_date('04/20/2004 12:00', 'MM/DD/YYYY HH:MI')
AND to_date('04/20/2004 12:02', 'MM/DD/YYYY HH:MI')
AND d.abaNum = '1111111'
AND c.transaction = 'CB'
ORDER BY c.baiDesc, detail.baiDesc, d.amount DESC

If anyone has any comments/suggestions, I would most welcome them.

TIA,

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top