Quantcast
Viewing latest article 2
Browse Latest Browse All 4

Answer by Tim Biegeleisen for SQL Query to get latest records for that user

Here is one PHP-friendly way to do this, using joins:

SELECT t1.*FROM yourTable t1INNER JOIN(    SELECT id, column1, MAX(completiondate) AS maxcompletiondate    FROM yourTable    GROUP BY id, column1) t2    ON t1.id = t2.id AND       t1.column1 = t2.column1 AND       t1.completiondate = t2.maxcompletiondate;

Viewing latest article 2
Browse Latest Browse All 4

Trending Articles