I've been trying to find a way to get a value from a column using mysql query.
The column (lets talk about colors) has several foreign keys (with no foreign constraint). So imagine a shirt can have blue and black, the column "color" will have "1,10" being 1-Blue and 10-Black, both foreign keys.
I want to create query to search if the color blue is being used so I can prevent deleting that color from his original table. Although it sounds easy, I can't use:
SELECT * FROM shirt WHERE color LIKE '%$id%'
The problem if it there's no blue color being used it will still find the black (10) and give a true value to the query.