how to – Setting a clause for cross join (sql)
I am looking to show a mutual friends function but my user friends list is stored on another table.
I want to know if it’s possible to use the data of each row as a clause for join B
SELECT * FROM ( SELECT * FROM `users`) a CROSS JOIN (SELECT COUNT(*) AS FRIENDS FROM `user_friends` WHERE `friend_to` = `a`.`userid`) b ORDER BY `b`.`FRIENDS` ASC
Or am I doing this totaly wrong?