I am trying to access the ring_to_number
from tbl_destinations
that holds all the numbers. And field destinations
has the comma separated ID like 1,3
. but according to this query i just get the the result of id 1
i didn't get the result of id 3
.
SELECT count( id ) AS totalDestination, group_concat( ring_to_number ) AS phoneNumbers
FROM tbl_destinations
WHERE id
IN (
SELECT destinations
FROM tbl_rings_to_groups
WHERE id = '1'
AND user_id = '1'
)
Can anyone please tell me why i didn't get the destinations
=>1,3
in SubQuery?
tbl_rings_to_groups:
tbl_destinations:
'1,3'
in your database. You should fix your schema, not that query.tbl_rings_to_groups
there is a field nameddestinations
has the comma separated ID's of tabletbl_destinations
. And in above subquery return only id1
not like1,3
tlb_destinations.id
, and not contain strings of any sort.