Hey,
Im having problems using LIKE when using a SELECT within the main SELECT.
items.tags might contains something to the effect of "1,2,3,".
The subquery returns one result in form of id which will be a number. To make my main select work I would idealy insert a wildcard before and after the injection from subquery so that the actual injection beomes "%1,%". Would make things real easy. But I cant get it working.
How would I form such a query so that it actually works lol ?
Any help appreciated, having googled for an hour im no smarter.
Thanks.
Im having problems using LIKE when using a SELECT within the main SELECT.
items.tags might contains something to the effect of "1,2,3,".
The subquery returns one result in form of id which will be a number. To make my main select work I would idealy insert a wildcard before and after the injection from subquery so that the actual injection beomes "%1,%". Would make things real easy. But I cant get it working.
How would I form such a query so that it actually works lol ?
Any help appreciated, having googled for an hour im no smarter.
Thanks.
Code:
# Psuedo code
SELECT items.path FROM items WHERE items.tags LIKE "%" + (SELECT tags.id FROM tags WHERE tags.name=one) + ",%"