MySQLi String comparisons using keys

Posted by asdasd on Stack Overflow See other posts from Stack Overflow or by asdasd
Published on 2010-05-20T21:49:26Z Indexed on 2010/05/20 21:50 UTC
Read the original article Hit count: 176

Filed under:
|
|
|

I have a table with lets say 2 columns. id number, and value. Value is a string (var char).

Lets say i have a number x, and a list of numbers a1, a2, a3, a4, a5..... where x is not in the list. All of these numbers correspond to a unique row in the table. I want to know if the string value for x in the table is contained in one of the string values for any table entry for a1, a2, a3, a4...

Lets say i have these rows:

 x, aaa
a1, bbb
a2, ccc
a3, ddd
a4, aaabbbcc

then i want somehow a confirmation that yes, the value for x is included in one of the values in my list of numbers (a4 contains x).

I know i can do this in a couple queries and shove it down some PHP and get my answer. But can i do this with one query?

© Stack Overflow or respective owner

Related posts about mysqli

Related posts about sql