I am working on dating website with php and mysql as backend. I've two tables. First table is user table where all user info will be stored and other table is visituser table where if one user view another users profile then there will be an entry in visituser table. Every time if one user visits another users profile then there will be an entry in visituser table. There will be multiple entry for one user visit to another user. My problem is that i've to show the visitor one time with latest visit date. My query is given below =>
SELECT
a.*, b.onlinestatus,
b.username,
b.age
FROM
tbl_visitprofile a
LEFT JOIN tbl_user b ON a.visitorid = b.id
WHERE
b. STATUS != '2'
AND a.visitmemberid = '10'
AND a.visitorid NOT IN (
SELECT
user_id
FROM
tbl_pauseusers
)
AND a.blockstatus = '0'
GROUP BY
a.visitorid
ORDER BY
a.id DESC
LIMIT 0,
12
If i am not using the group by in this query then i am getting the latest visit entry but if i am using group by then i am not getting the latest visit entry. I'd searched alot but didn't find my annswer anywhere. Any help will be appreciated. Thanks in advance