P粉0368000742023-08-18 10:38:23
FIND_IN_SET is your friend in this case
select * from shirts where FIND_IN_SET(1,colors)
P粉2540777472023-08-18 00:12:51
The classic method is to add commas on the left and right sides:
select * from shirts where CONCAT(',', colors, ',') like '%,1,%'
But find_in_set can also be used:
select * from shirts where find_in_set('1',colors) <> 0