Reputation: 433
Hi guys I have this situation
tabperfil
ta
bperfil.Cidade_Id -> values = 12,34,645,21
then I have a $id = 12
so I'm try to do this query
select * from tabperfil limit 0,5
but with a condiction for get the values of Cidade_Id
and check with $id
if was a reverse situation I know
select * from tabperfil WHERE Cidade_Id IN ($id)
so how do something to works like this
select * from tabperfil WHERE ($id) in Cidade_Id
Upvotes: 1
Views: 175
Reputation: 70460
WHERE FIND_IN_SET($id, Cidade_Id) > 0
But you should really normalize your database. Having comma-seperated values in 1 column is asking for trouble.
Upvotes: 5