If you're not using SQL 2005, the following (slightly more complex) query 
should simulate the RANK and PARTITION:

SELECT id, name, date_due, date_modified
FROM (
SELECT id, name, date_due, date_modified, (SELECT COUNT(id) FROM table T2 WHERE 
T1.id = T2.id AND T2.date_modified >= T1.date_modified) AS userRank
FROM table T1
) AS rankedTable
WHERE rankedTable.userRank <= 2
ORDER BY id, date_modified DESC

The only caveat is that if you have two entries with exactly the same date 
stamp, the ranking might be thrown off; but that's fairly unlikely... 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315486
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to