I am trying to fetch distinct record from mysql table order by visit time which should be latest visit with below query:
SELECT COUNT(*) as cookie_id, id, lead_id
FROM analytics where lead_id != 0 and user_id = 1
GROUP BY lead_id
HAVING cookie_id > 1 order by visit_time desc
But with above query i am getting wrong result.
** My Required result initial:**
2054, 2016-02-02 14:19:40
2051, 2016-02-02 13:54:17
2055, 2016-02-02 12:22:16
2039, 2016-02-02 11:46:49
My original data table screen attached.from below table i am trying to get filter result..