Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi All,
I have a table wich contains a set of appointments:
afspraakid, day, room_number, description
For example, the table is filled like this
1, wednesday, 104, drinking a cup of tea
2, thursday, 101, writing a program
3, wednesday, 104, reading a book
4, tuesday, 104, listening to musicI want to automatically select all the days that a room is 'double-booked'. In my example I want MySQL to output wednesday as a day to be aware of problems because reading a book and drinking a cup of tea is scheduled in the same room wich, obviously, will lead to problems.
I dont know what the SELECT-statement must look like to achieve this...
Any suggestions?

There are a few different ways to do it, but the most straightforward way I could think of is something like this:
select * from appts a, appts b where a.room=b.room and a.time=b.time and a.id != b.id;
Make sense?
-SN

Right! I didnt know, and haven't tried it because I didnt know it, that you can make a join with one table instead of two!
Thank you very for the quick help!GREAT!
Khalid.

![]() |
Asp remote connection scr...
|
Javascript double combo b...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |