I’m sorry for the title, but I didn’t find a better one.
My problem is the following:
I want to select all fields from table “log” where field “user” is “user1” or “user2 in “friendships”. My query looks like this, but it returns a zero value:
SELECT * FROM `log`
WHERE `user` = ANY(SELECT `user1` FROM `friendships`
WHERE (`user1` = 1 OR `user2` = 1) AND `active` = 1)
OR `user` = ANY(SELECT `user2` FROM `friendships`
WHERE (`user1` = 1 OR `user2` = 1) AND `active` = 1)
GROUP BY `arguments`
ORDER BY `created` DESC
If I used only one subquery it works, but I need the second field too. And there are more values (that’s the reason why I use subqueries with ANY and not JOIN).
I hope somebody finds my error :).
i hope this works:
PS: Can post the schema (or structure) of your table?
UPDATE 1