I've a table that has id_categoria
field having comma separated value, e.g., 1,2,3,4,64,31,12,14
, because a record can belong to multiple categories. If I want to select records that belongs to category 1
, I have to run following SQL query
SELECT *
FROM cme_notizie
WHERE id_categoria LIKE '1%'
ORDER BY `id` ASC
and then select all records from the record set that have id_categoria
exactly 1
in id_categoria
. Let's assume that the value 1
does not exist, but column value like 12, 15, 120 ... still contains 1
.
There is a way to take only 1? without taking derivatives or other?