I'm trying to form a table with unique column values as the column names and I'm not sure how to do that. The values will be either true or false/null.
Here's the setup:
PROJECTS
ProjectID | ....
---------------------------
1111 | .....
2222 | .....
PROJECT_TAGS
TagID | ProjectID | TagDefID (TagNameID fkey)
-----------------------------
1 | 1111 | 5
2 | 1111 | 6
3 | 2222 | 5
TAG_NAMES
TagNameID | TagName
-----------------------------
5 | Is Really Cool
6 | Is Awesome
RESULT
ProjectID | Is Really Cool | Is Awesome
-----------------------------------------
1111 | true | true
2222 | true |
Now the tricky part is that additional tag types will be added as time goes on. It seems really gross and slow to have to iterate over each project ID so I was hoping there would be some sort of magic SQL trick to sort this out. Basically I need to make an XML spreadsheet type view of the database because reasons.
Thanks!