I have this query to pull out meeting schedule records based on time comparison.
StartTime and EndTime are in the format of i.e. 2007-04-23 09:00:00.0 and 2007-04-23 08:00:00.0
SELECT
tblActivity.Name AS thename,
tblActivity.StartTime as thetime,
tblActivity.EndTime as theendtime,
tblActivity.AttendingCount as thecount,
tblRoom.Name AS theroom
FROM tblActivity
LEFT JOIN
(jncRoomDetails LEFT JOIN tblRoom
ON jncRoomDetails.RoomID = tblRoom.ID)
ON tblActivity.ID = jncRoomDetails.ActivityID
WHERE DATEPART(yy, tblActivity.EndTime) = DATEPART(yy, GETDATE()) and
DATEPART(mm, tblActivity.EndTime) = DATEPART(mm, GETDATE()) and
DATEPART(dd, tblActivity.EndTime) = DATEPART(dd, GETDATE()) and
GETDATE() < tblActivity.EndTime AND
jncRoomDetails.UserScheduled <>0 AND
tblActivity.ScheduleStatus Not In (1,2,3)
GROUP BY
tblActivity.Name,
tblActivity.StartTime,
tblActivity.EndTime,
tblActivity.AttendingCount,
tblRoom.Name,
tblActivity.ID,
jncRoomDetails.UserScheduled
HAVING
(((tblActivity.StartTime) > ** getdate () for today **
AND ((jncRoomDetails.UserScheduled)<>0))
ORDER BY
tblActivity.StartTime
What I want is to pull out the meetings displayed 1 hour before the actual StartTime of the meeting and end the display at the scheduled meeting EndTime. How do you modify this query?
Thx much
StartTime and EndTime are in the format of i.e. 2007-04-23 09:00:00.0 and 2007-04-23 08:00:00.0
SELECT
tblActivity.Name AS thename,
tblActivity.StartTime as thetime,
tblActivity.EndTime as theendtime,
tblActivity.AttendingCount as thecount,
tblRoom.Name AS theroom
FROM tblActivity
LEFT JOIN
(jncRoomDetails LEFT JOIN tblRoom
ON jncRoomDetails.RoomID = tblRoom.ID)
ON tblActivity.ID = jncRoomDetails.ActivityID
WHERE DATEPART(yy, tblActivity.EndTime) = DATEPART(yy, GETDATE()) and
DATEPART(mm, tblActivity.EndTime) = DATEPART(mm, GETDATE()) and
DATEPART(dd, tblActivity.EndTime) = DATEPART(dd, GETDATE()) and
GETDATE() < tblActivity.EndTime AND
jncRoomDetails.UserScheduled <>0 AND
tblActivity.ScheduleStatus Not In (1,2,3)
GROUP BY
tblActivity.Name,
tblActivity.StartTime,
tblActivity.EndTime,
tblActivity.AttendingCount,
tblRoom.Name,
tblActivity.ID,
jncRoomDetails.UserScheduled
HAVING
(((tblActivity.StartTime) > ** getdate () for today **
AND ((jncRoomDetails.UserScheduled)<>0))
ORDER BY
tblActivity.StartTime
What I want is to pull out the meetings displayed 1 hour before the actual StartTime of the meeting and end the display at the scheduled meeting EndTime. How do you modify this query?
Thx much