Home » SQL & PL/SQL » SQL & PL/SQL » query result between 2 constaint time BUT vary Date
query result between 2 constaint time BUT vary Date [message #196558] Thu, 05 October 2006 22:02 Go to next message
pcgame4u
Messages: 14
Registered: July 2006
Junior Member
i am going to select records that:
update_date < today date @ 8:59 AND update_date > yesterday date @ 17:00

for examples, today date = 18 Oct , yesterday date = 17 Oct

update_date < 18 Oct 8:59 AND update_date > 17 Oct 17:00

i know that the day portion can use
sysdate - 1(yesterday), sysdate(today)
but how can i construct the time part?

thx all of you help.
Re: query result between 2 constaint time BUT vary Date [message #196575 is a reply to message #196558] Fri, 06 October 2006 00:51 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Something like this?
SELECT * FROM your_table
WHERE update_date BETWEEN
       TO_DATE(TO_CHAR(SYSDATE - 1, 'dd.mm.yyyy') || '17:00', 'dd.mm.yyyy hh24:mi') 
	   AND
       TO_DATE(TO_CHAR(SYSDATE, 'dd.mm.yyyy')     || '08:59', 'dd.mm.yyyy hh24:mi')
Previous Topic: sql loader
Next Topic: seperate the First Name and Last Name
Goto Forum:
  


Current Time: Thu Dec 08 20:05:28 CST 2016

Total time taken to generate the page: 0.09797 seconds