Hey guys I have the following 3 tables:
person event attendance
| id | name | age | | id | name | added | | id | pId | eId | attended |
|-----------------| |---------------------------| |---------------------------|
| 5 | bob | 20 | | 0 | wedding | 01.01.2013 | | 0 | 5 | 0 | YES |
| 6 | ryan | 25 | | 1 | party | 01.01.2013 | | 1 | 5 | 1 | NO |
So "person" and "attendance" are growing dynamically and "event" is a static table to hold the event names. I am trying to achieve the following result:
| id | name | age | wedding | party |
|-----------------------------------|
| 0 | bob | 20 | YES | NO |
| 1 | ryan | 25 | NO | NO |
I should propably mention that my live database is quite big (I have like 11 static event names, so this example would end up with 14 columns) and there is also another table (simulating flags) in between so performance is quite important. I wonder if this is even possible with one single query and how to exactly achieve it?