Reputation: 694
I have two tables a
and b
.
Table a
has a field named gr
which can have multiple values concatained with string.
Table b
holds it seperately in fields lg
.
How do i run the below query to check whether b.lg
is in a.gr
?
SELECT lg FROM `a`,`b` WHERE a.`id` =22 AND (a.gr LIKE '%'+b.lg+'%')
Upvotes: 0
Views: 179
Reputation: 29081
You need to use CONCAT function try:
SELECT lg
FROM a, b
WHERE a.id = 22 AND
a.gr LIKE CONCAT('%', b.lg, '%');
Upvotes: 1