Hi I'm creating a website that uses a count query, to see how many things in the database match a variable.
Whats Liked User Liked By
Now, I'm trying to see people who like the same thing as you do, and am ordering them by the amount of things you have in common. Lets say you like potatoes and computers as well. It will display djiajgi, djiagi two times. I'd like it to appear only once like here http://sqlfiddle.com/#!2/b6f78/8 How would I go about doing this, so if I like computer and potatoes, it will display djiajgi only once? Code :
$people_like = mysqli_query ($link, "SELECT COUNT(user_liked_by) AS total, id, user_liked_by FROM whatilike WHERE whats_liked LIKE '%$thing_liked%' && user_liked_by !='$user' GROUP BY user_liked_by ORDER BY COUNT(user_liked_by) DESC; ");