Please start any new threads on our new
site at http://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Our new SQL Server Forums are live!
Come on over! We've restricted the ability to create new threads on these forums.
Yak Posting Veteran
SELECT Name, MAX(Date)
GROUP BY Name
WITH t AS (
SELECT name, date, total,
row_number() over (partition by name order by date desc) ix
SELECT t1.name, t1.date, t1.total
FROM t t1
JOIN t t2
On t1.name = t2.name
And t1.ix = 1
And t2.ix = 2
WHERE t1.total > t2.total;