Need help with a SELECT statement
Posted
by Travis
on Stack Overflow
See other posts from Stack Overflow
or by Travis
Published on 2010-04-09T13:49:14Z
Indexed on
2010/04/09
14:03 UTC
Read the original article
Hit count: 233
I express the relationship between records and searchtags that can be attached to records like so:
TABLE RECORDS
id
name
TABLE SEARCHTAGS
id
recordid
name
I want to be able to SELECT records based on the searchtags that they have. For example, I want to be able to SELECT all records that have searchtags:
(1 OR 2 OR 5) AND (6 OR 7) AND (10)
Using the above data structure, I am uncertain how to structure the SQL to accomplish this.
Any suggestions?
Thanks!
© Stack Overflow or respective owner