>This solution is similar to Greg's in that I will get dupes if more than
>one product is added at the same time.
Sql 2005 may have a better method for doing this, but you could use 2 derived
tables. One to grab the max date by order number, and the other to grab the max
record id per order number. Then do an INNER JOIN to get the detailed records.
Totally untested, but something like this
SELECT t.*
FROM t1 AS t INNER JOIN (
SELECT mi.order_number, MAX(mi.YourRecordID) AS YourRecordID
FROM t1 AS mi
INNER JOIN
(
SELECT order_num, max(datetime_created) as latestdate
FROM t1
GROUP BY order_num
)
AS md ON mi.order_num = md.order_num
AND mi.datetime_created = md.latestdate
GROUP BY mi.order_number
)
AS mx ON t.YourRecordID = mx.YourRecordID
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289760
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4