Hi,
I was trying to print only unique/ distinct sender name in my conversation list.
Here is my current code
$sql = "SELECT
a.name, b.id, b.byuid, b.unread, b.starred FROM all_users_table a
INNER JOIN private_messages b ON a.id = b.byuid
WHERE b.touid='".$myid."' AND starred='0'
ORDER BY b.timesent DESC, b.unread
LIMIT $limit_start, $items_per_page
";
This currently printing
user1
user1
user1
user2
user2
user3
What I wanted to print
>user1
>user2
>user3
Is it possible ?
I tried with Group By buyuid but it returns random user NOT order by tme sent / unread one first.
How can I solve this ? !
I was trying to print only unique/ distinct sender name in my conversation list.
Here is my current code
$sql = "SELECT
a.name, b.id, b.byuid, b.unread, b.starred FROM all_users_table a
INNER JOIN private_messages b ON a.id = b.byuid
WHERE b.touid='".$myid."' AND starred='0'
ORDER BY b.timesent DESC, b.unread
LIMIT $limit_start, $items_per_page
";
This currently printing
user1
user1
user1
user2
user2
user3
What I wanted to print
>user1
>user2
>user3
Is it possible ?
I tried with Group By buyuid but it returns random user NOT order by tme sent / unread one first.
How can I solve this ? !
Comment