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

Comparing dates

Status
Not open for further replies.

FunkyBunch

Instructor
Sep 11, 2007
35
CA
Hello all,

I am comparing two dates in sql and it seems to be missing some records.

the statement i am running is:

select next_insp_date_Fw, last_insp_date_Fw, archive_status_Fw, insp_description_Fw, getdate()
from user_defined19_fw
where vehicle_id_fw = '1105' and next_insp_date_fw <= getdate()

and i recieve nothing in return. When i take off the date comparison as shown:

select next_insp_date_Fw, last_insp_date_Fw, archive_status_Fw, insp_description_Fw, getdate()
from user_defined19_fw
where vehicle_id_fw = '1105'

it returns this data:

2007-12-14 00:00:00.000 -next insp date
2007-06-14 00:00:00.000 -last insp date
N -archive status
CVIP -Inspection
2007-11-23 11:58:37.130 - Getdate()

Thanks!
 
the next_insp_date_fw for that row of 2007-12-14 is in the future

stipulating that this column must be less than 2007-11-23 will properly not return the row

[COLOR=black #e0e0e0]For SQL and technical ideas, visit my blog, Squared Thoughts.

[sub]The best part about anything that has cheese is the cheese.[/sub][/color]
 
And I should ask, why in tarnation do you have "_fw" on the end of each column? If it refers to the table it came from, I recommend that if at all possible, as soon as possible you stop doing this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top