MySQL Forums
Forum List  »  Newbie

Re: Need help withquery
Posted by: Cecil Carpenter
Date: October 19, 2016 10:18AM

I have tried the query as you wrote it, but it still fails. Here is a specific example.

If a person has two different guests for two different events, both guests will show in the query result for either of the events which one of the guest attended. That is, if person A has guest B for event 2 and guest C for event 4, both B and C show for event 2 and for event 4.

I think the problem is in the way I have the tables defined. For person and guest, whether they attended is indicated in the attendee table for person. Here are the table definitions with the relevant columns.

person table

Person_ID
First_Name
Last_Name
Spouse_Name
...

guest table

Guest_ID
Guest_First_Name
Guest_Last_Name
Person_ID

attendee table

Attendee_ID
Person_ID
Event_ID
Registered
Spouse_Registered
Guest_Registered
Attended
Spouse_Attended
Guest_Attended

Only the person table has columns omitted because they are attributes of the Person. I have no problem with spouses, because their name is in the person table.

However, the guest name is only in the guest table. So I have an attendee table depending on the person table but not on the guest table. Does that description make sense?

It seems to me I need to alter some table definition(s), but I'm having a hard time getting my head around how to do that. I have both persons (and spouses, no problem) and guests in the attendee table (i.e., their registration and attendance at an event is in the attendee table) and both are controlled by Person_ID, I think that is causing this issue. Does that seem to be a problem from your perspective?

Options: ReplyQuote


Subject
Written By
Posted
October 18, 2016 05:22PM
October 18, 2016 09:30PM
Re: Need help withquery
October 19, 2016 10:18AM
October 19, 2016 10:27AM
October 19, 2016 11:04AM
October 19, 2016 03:16PM
October 20, 2016 11:11AM
October 20, 2016 02:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.