?
Solved

sql select statement

Posted on 2012-03-12
3
Medium Priority
?
368 Views
Last Modified: 2012-08-13
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.
0
Comment
Question by:ocdc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 2000 total points
ID: 37708636
Try

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-jan-2011' and te.Training_Category_ID = tc.Training_Category_ID and Staff_Training_ID = " & lv_Staff_Training_ID & " Order by te.Training_Date;"


Kelvin
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 37708640
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

0
 

Author Closing Comment

by:ocdc
ID: 37708648
Thanks for the quick help.  Worked great.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question