Using a subquery in a filter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a booking database which records bookings for each room in a series of
half hour slots. If a room is booked for an hour there would be two records
- one for each half hour. The current report would show each of these. I
have tried building a query like the one below which I hoped would show a
single result for each room with the initial start time and the final end
time. The problem I am having is with the filter. Can anyone please tell
where I have gone wrong or suggest an alternative method. Thanks in advance.
Peter

SELECT Min([Schedule Details].ScheduleStartTime),
Max([Schedule Details].ScheduleEndTime)
FROM [Schedule Details];
WHERE
ScheduleID=( SELECT DISTINCT[Schedule Details].ScheduleID
FROM [Schedule Details]);
 
Hi Peter,

Difficult to help you without seeing the layout of your table(s). However I
was surprised not to see a GROUP BY clause in your SQL.

Regards,

Rod
 
Back
Top