newone2011
asked on
MS SQL Query to search between dates
I want to write a query where I can serarch from a table based on date column, however I do not want pass any date. THe requirement is to always search today's data or yesteday's date betweenn 0000 and 2359 hrs.
For example:
select * from Table1 where entryDate>=todays date 0000 and <todays's date 2359.
for todays's date can I use sysdate or something like that instead of passing a value from the program ?
For example:
select * from Table1 where entryDate>=todays date 0000 and <todays's date 2359.
for todays's date can I use sysdate or something like that instead of passing a value from the program ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
dqmq,
Returns the same thing, just in a different way.
Returns the same thing, just in a different way.
take alook into this link to play around Datetime function in SQL and MYSQL
http://www.w3schools.com/sql/sql_dates.asp
http://www.w3schools.com/sql/sql_dates.asp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys let me test
ASKER
no
select * from Table1 where entryDate>=getdate() and entryDate<getdate()