I have a column in my MySQL table. The column name is “attached_products”, now, for example I have some records there and the attached_products have a value “1,16,164,1645”, how do I select all records with “16”?
I tried the where clause, it went something like:
select * from websites where attached_products like '%16%'
but it also select the records with 164 and 21645.
Thanks for any help! 🙂
since you are using a bad design for your database you could use, like you said:
but you should consider redesigning your database for easier selects. You can add another table with only those attached products like:
where id_product is from table 1 and product is the product id