Link to home
Start Free TrialLog in
Avatar of ocdc
ocdcFlag for United States of America

asked on

sql select statement

I have this select statement.  I'm trying to restrict the returned te.Training_Date to be no later than 1/1/2011.  I"m not able to get this part (where te.Training_Date <= 1/1/2011 12:00:00)) of my syntax to work correctly.  The Training Date has smalldatetime datatype.
 
SQL = "Select Training_Events_ID, tc.Training_Area, te.Class_Title, te.Training_Date, te.Training_Hours from Training_Events te, Training_Category tc where te.Training_Date <= 1/1/2011 12:00:00) and te.Training_Category_ID = tc.Training_Category_ID and Staff_Training_ID = " & lv_Staff_Training_ID & " Order by te.Training_Date;"

Open in new window


Thanks for looking at this.
ASKER CERTIFIED SOLUTION
Avatar of Kelvin Sparks
Kelvin Sparks
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try

SQL = "Select Training_Events_ID, tc.Training_Area, te.Class_Title, te.Training_Date te.Training_Hours from Training_Events te inner join Training_Category tc on te.Training_Category_ID = tc.Training_Category_ID where te.Training_Date <= '20110101'  
and Staff_Training_ID = " & lv_Staff_Training_ID & " Order by te.Training_Date;"

Open in new window

Avatar of ocdc

ASKER

Thanks for the quick help.  Worked great.