I have an items table and a tags table that are linked through a user_tags table. I have a query that finds all items with specific tags:
self::factory('item')
->join('user_tags', 'INNER')->on('items.id', '=', 'user_tags.item_id')
->join('tags', 'INNER')->on('user_tags.tag_id', '=', 'tags.id')
->where('tags.title', 'IN', $array_of_tags);
or without kohana orm:
SELECT items.*
FROM items
INNER JOIN user_tags ON items.id = user_tags.item_id
INNER JOIN tags ON user_tags.tag_id = tags.id
WHERE tags.title IN ($array_of_tags);
I would like to find all items that have no tags associated to them. How would I do this?
Simply add another where condition