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

Selecting records based on today's date

Status
Not open for further replies.

trc

MIS
Nov 27, 2000
126
CA
I am trying to select records from a DB where the post_date is >= the system date and the expiry_date <= the system date. How do I do this in SQL?

I have tried to use the advanced SQL window but it did not recognise my code for the system date &quot;formatdatetime(date, 1)&quot; or just &quot;date&quot;.
Caution, dates on calendar are closer then they appear.
 
HEllo trc!

First of all, it's not a question for DreamWeaver forum, but for DreamWeaver UltraDev.
Next, what techique are you using: ASP, JSP, ColdFusion?
Last, what are field names in you DataBase for dates?

Can you answer these questions for beginning?

Good Luck!
 
What DB are you using? On Sybase/SQL Server it would be the getdate() function.

select * from mytable where date_field < getdate()

Greg.
 
Darn that was quick. Yeah I guess you need to know a little more huh. I am using ASP with an Access db.

Caution, dates on calendar are closer then they appear.
 
Hello trc!

Use these buildin Access functions Date() or Now(). So you may have your query look like this:

&quot;SELECT * FROM table_name WHERE post_date >= Date() AND expiry_date <= Date()&quot;

Try it, must work.

Good Luck!



 
Great. Thank you for the help and being so quick to response. Caution, dates on calendar are closer then they appear.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top