Computing.Net > Forums > Web Development > mysqlquery duplicate entries in row

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

mysqlquery duplicate entries in row

Reply to Message Icon

Name: Khalid
Date: December 19, 2004 at 11:17:33 Pacific
OS: winXP-prof
CPU/Ram: 2,4 GHz / 1 GB
Comment:

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 music

I 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?



Sponsored Link
Ads by Google

Response Number 1
Name: SN
Date: December 19, 2004 at 13:29:21 Pacific
Reply:

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


0

Response Number 2
Name: Khalid
Date: December 19, 2004 at 13:39:05 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Asp remote connection scr... Javascript double combo b...



Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: mysqlquery duplicate entries in row

PHP Question about MYSQL interactio www.computing.net/answers/webdevel/php-question-about-mysql-interactio/1430.html

php form not work www.computing.net/answers/webdevel/php-form-not-work/2423.html

number of entries in array www.computing.net/answers/webdevel/number-of-entries-in-array/3764.html