How would I change the SQL to give me distinct room types? I want only one roomtype_id to each room_id. If that makes any sense? Basically If have 5 rooms of 3 different types, only 3 records should come back.
Heres an example of the current SQL…
SELECT dbo.rooms.room_id,dbo.roomtypes.name, dbo.rooms.roomtype_id
FROM dbo.rooms INNER JOIN dbo.roomtypes ON dbo.rooms.roomtype_id = dbo.roomtypes.roomtype_id
WHERE
(dbo.rooms.room_id NOT IN (SELECT
room_id FROM dbo.booking))
AND( dbo.rooms.roomtype_id >= 4)
One way is
GROUP BY: