i am fetching records from two tables with inner join, but i am not getting proper result.
Here is my code :
real_query = "SELECT DISTINCT user.id AS uid, user.name AS unm, user.profile_pic AS upic, user_message.message_by_id AS message_by_id
FROM user INNER JOIN
user_message
ON user.id = user_message.message_by_id
where (user_message.message_to_id = '".$sess."' AND
user_message.receiver_deleted = 'No')
group by user_message.id, user_message.sent_on
order by user_message.id DESC ";
The problem is, i want to echo those user names from user table, order by user_message.id but i am not getting the result as i want.