0

I am writing a query like

SELECT t.tag
FROM   Tags t,Device_Tags dt
WHERE  t.tag IN (SELECT tag_id
                 FROM   Device_Tags
                 WHERE  device_id = '464')
       AND dt.device_id = '464' 

i need it to produce a query like

SELECT t.tag
FROM   Tags t,Device_Tags dt
WHERE  t.tag IN ( 124, 124, 125 )
       AND dt.device_id = '464' 

my tables are like

Tags table

tag_id tag
============
123    xyz
124    abc
125    Tags 

Device_tags

id    tag_id        device_id
==============================
1    123,124            1
2    123,124,125        1
3    123,124,125        1

i need all the tag name based on the device_id

Please help me how can i achieve this.

Deep
  • 3,162
  • 1
  • 12
  • 21

0 Answers0