Hi I cant figure out any good way to get a list of tag.names and lang which isn't already inserted in combination inside images_urls.
My database looks something like this.
tags name user_id +-------+---------+ |hi | 1 | |friend | 1 | |friend | 2 | |people | 2 | +-------+---------+ users id lang +---+------+ | 1 | en | | 2 | sv | +---+------+ images_urls name lang +--------+------+ | hi | en | | friend | sv | +--------+------+
What I would like to have returned would be:
result name lang +-------+------+ |friend | en | |people | sv | +-------+------+
I have tried something like this:
SELECT tags.name, users.lang
FROM tags, users
WHERE tags.user_id = users.id
AND CONCAT(tags.name, ',', users.lang) NOT IN(
SELECT DISTINCT CONCAT(name, ',', lang) FROM images_urls
)
GROUP BY CONCAT(name, ',', lang)
ORDER BY SUM(tags.count) DESC
LIMIT 20;
Thanks.