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

Newbie: SQL date problem

Status
Not open for further replies.

orangejosh

Technical User
May 1, 2006
3
0
0
US
Hello. I have the following SQL query:

Code:
SELECT Sum(usersProjectDetail.userProjectDetailHours) AS TotalHours
FROM (users INNER JOIN (project INNER JOIN usersProject ON project.projectID = usersProject.projectID) ON users.userID = usersProject.userID) INNER JOIN usersProjectDetail ON usersProject.userProjectID = usersProjectDetail.userProjectID
WHERE (((users.userID)=1) AND ((usersProject.projectID)=17));

I'd like to add start and end dates to this. Right now, it just gives me back the total hours in the entire table. For example, I'd like to only know the hours between 4/15/2006 and 5/1/2006. Thanks!
 
In the WHERE clause remove the semi-colon and add
Code:
AND SomeDateField BETWEEN [Start Date] AND [End Date]

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top