1
I have a column called relacionados
on the table produtos
and there are some ID’s of some table items produtos
. I needed to make a explode() or something like that on the table produtos
and selects all products with the ID’s that are in this table relacionados
. Would there be any possibility ? The Ids are separated by , (commas).
Tabela = produtos
Coluna = relacionados
But I don’t need to return how many ID’s I have. What I need is to return as several SELECTS
with the ID’s in the column relacionados
. For example, in the column relacionados
I have so: 2,3,5,10
so I had to do something like this:
SELECT * FROM produtos WHERE id = 2
SELECT * FROM produtos WHERE id = 3
SELECT * FROM produtos WHERE id = 5
SELECT * FROM produtos WHERE id = 10
It’s just to compare a value? that answer resolves?
– rray
and how do you decide which line of "related" will pick up? If it is a second query, it is exactly what has already been answered. Assuming the column is in $related
"SELECT * FROM produtos WHERE FIND_IN_SET( id, '$relacionado');"
– Bacco