lundi 2 mars 2015

MySql – Get comma separated values from a table, should not exist in another table


I have two tables, table structures as below.



Table: items
Id item_name item_ids
1 pens 10,11,12,13
2 books 20, 30
3 computer 50, 60, 80

Another table : activities

Id activity_id
1 10
2 11
3 20
4 60

So Now I want to get item_ids from items table which are not present in activities table using JOINS NO SUBQUERY. Lets say I want to retrieve item_ids of pens those are not in activities table. Ex For pens, item_ids are 10, 11,12,13. My result should be 12 and 13.





Aucun commentaire:

Enregistrer un commentaire