954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Date and Time compare question

Hello Gurus,

I have a table that holds one date field and one time field.
The formats are 2011-12-01 and the time field format is 22:55:01

I want to compare a string "2011-12-01 22:58:00" to the date and time field
of the table, without having to take the string apart.

SELECT * FROM usrteams where '2011-12-01 22:58:00' <= games.gamedate + games.cutofftime

This above does not seem to look right... any suggestions ?

Thanks in advance.
Peter

ppohlmann
Newbie Poster
12 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

You are comparing with two fields in the database with concatenation.
You should compare each field alone

SELECT * FROM usrteams where '2011-12-01' <= games.gamedate and  '22:58:00'  <= games.cutofftime
peter_carlos
Newbie Poster
19 posts since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

thanks .. works great ..

ppohlmann
Newbie Poster
12 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: