I am going to write a sql command to retreive data by choosing multiple or selection. I have given written query by me, does anyone have alternative sql query for my query which gives same result?
It gives startdate for userid 4 and userid 37 in between given date range.
SELECT
UserID, StartDate, EndDate
FROM
dbo.TimeEntry
WHERE
(UserID = 4) AND (StartDate BETWEEN CONVERT(DATETIME, '2011-02-02 00:00:00',
102) AND CONVERT(DATETIME, '2011-02-05 00:00:00', 102)) OR
(UserID = 37) AND (StartDate BETWEEN CONVERT(DATETIME, '2011-02-02 00:00:00', 102)
AND CONVERT(DATETIME, '2011-02-05 00:00:00', 102))
1 Answer