Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 09-08-2006, 03:19 PM subquery problem
Junior Talker

Posts: 4
Trades: 0
I have three tables that I am using to track who attends meetings on a particular date:

Code:
people - person_ID, lname, fname
date - date_id, date
attendance - attendance_ID, person_ID, date_ID
Since the meetings are held once I week at the same location, I only need to track the date of the meeting. But my problem is I need to show who was NOT present at the meeting on a particular date. I am using the following query since I am using MySQL Version 4.0.25-standard. Evidentially, I have to have version 4.1 to use the NOT IN query.

Code:
SELECT people.* FROM people LEFT JOIN attendance ON people.person_ID=attendance.person_ID WHERE attendance.date_ID IS NULL ORDER BY people.lname, people.fname;
My problem is I need to find out who did not show up for a particular date. The query I have above shows everybody in the database who has never shown up for any meeting. I can't figure out what I'm doing wrong. Any suggestions? Any help is appreciate. And thanks in advance.
cbesh2 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-11-2006, 10:53 PM Re: subquery problem
Extreme Talker

Posts: 246
Trades: 3
How about this:
Code:
SELECT people.* FROM people 
LEFT OUTER JOIN attendance 
ON people.person_ID=attendance.person_ID 
WHERE attendance.person_ID IS NULL 
and attendance.date_ID = {the date_id that corresponds to the date you're looking for}
ORDER BY people.lname, people.fname
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
CouponGuy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to subquery problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09586 seconds with 12 queries