I have table like this:
| user1 | user2 | | 1 | 2 | | 3 | 1 | | 4 | 1 | | 1 | 5 | | ... | ... |
I wanna mer
SELECT user1 AS users FROM `table` WHERE user1 NOT IN (SELECT user2 FROM `table`) UNION SELECT user2 AS users FROM `table` WHERE user2 NOT IN (SELECT user1 FROM `table`) ORDER BY users
SELECT IF(user1 = 1, user2, user1) AS user FROM table WHERE user1 = 1 OR user2 = 1