>I am trying to group my results by the last activity on each row,
>looks like this
>select text, dt, item_id from table
>group by item_id
>order by dt DESC
SELECT t1.item_id, t1.dt, t1.text
FROM table AS t1
LEFT JOIN table AS t2 ON t1.item_id = t2.item_id AND t1.dt < t2.dt
WHERE t2.item_id IS NULL;
Tanner Postert wrote:
The situation is somewhat hard to describe, so please bare
I am trying to group my results by the last activity on each row, my
looks like this
select text, dt, item_id from table
group by item_id
order by dt DESC
here is an example record set.
the results from the above query would be:
my problem is that i want the other item to show up. the item with the
recent DT. it is doing the grouping before it does the ordering. how do
specify that I want to see the most recent info when it does the group?
thanks in advance.
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.5/377 - Release Date: 6/27/2006