How can I group this sql query? I want to print the records only 1 time …
SELECT
friend_id,
friend_adding_id,
friend_added_id,
user_id,
user_name
FROM friends
LEFT JOIN users ON (friends.friend_adding_id = users.user_id OR friends.friend_added_id = users.user_id)
WHERE
friend_adding_id = 1 OR friend_added_id = 1
AND friend_confirm = 1
ORDER BY friends.friend_id DESC
LIMIT 1, 10
The SQL GROUPBY clause is used in collaboration with the SELECT statement to arrange identical data into groups . This GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause.