I have a table that keeps tags and their reference. For example:
| tag | tableName | rowId | | ---- | --------- | ----- | | tag1 | table1 | 1 | | tag2 | table1 | 1 | | tag1 | table2 | 1 |
I would like to form a query that says something like "get distinct table name and rowId WHERE it has all of these tags: 'tag1', 'tag2'"
The objective of this table is to make it easy to look up rows in tables by tags. Maybe I'm going the complete wrong direction with how to solve this.
How can I do this and keep performance high?
Thanks for the help.