Unknown Column?
- by Kenny
ok im trying to get mutual friends between these Two users, user1 and user92
This is the sql that is successful in displaying them
SELECT IF(user_a = 1 OR user_a = 92, user_b, user_a) friend
FROM friendship
WHERE (user_a = 1 OR user_a = 92) OR (user_b = 1 OR user_b = 92)
GROUP BY 1
HAVING COUNT(*) > 1
THis is how it looks
friend
61
72
73
74
75
76
77
78
79
80
81
So now i want to select all users after the number 72, and i try to do it with this sql but its not working? It gives me the error, "unknown coulum name friend in where clause"
SELECT IF(user_a = 1 OR user_a = 92, user_b, user_a) friend
FROM friendship
WHERE friend > 72 and (user_a = 1 OR user_a = 92) OR (user_b = 1 OR user_b = 92)
GROUP BY 1
HAVING COUNT(*) > 1
what am i doing wrong? or what is the correct way?? thx