Quantcast
Channel: MySQL
Viewing all articles
Browse latest Browse all 14

Getting the mysql where in delimited string to work

$
0
0
What?
I have a mySQL database table of room assets that has a field containing the ID numbers of images relevant to this room.

The Problem?
When I select specifying the statement "WHERE IN (c.RoomImages)", this is interpreted as a string and when converted to a number only retrieves the first value before the first comma. Consider the following, the first query is how MySQL interprets the query and the second is what I want it to do:
SELECT value FROM my_table WHERE my_id IN ('1, 2, 3')
SELECT value FROM my_table WHERE my_id IN ('1', '2', '3')


Viewing all articles
Browse latest Browse all 14

Trending Articles