I do, I have both of those and currently do a join onto a subquery to get this data but the LAST() function would make for much simpler code.
-- Jay -----Original Message----- From: G Money [mailto:[EMAIL PROTECTED] Sent: 19 November 2007 13:34 To: CF-Community Subject: Re: MSSQL Aggregate Functions You don't have a date stamp or an enumerated primary key to help you determine which cost is the most recent???? You REALLY need a better way of determining order than position in the database...ie "last". On Nov 19, 2007 6:12 AM, James Smith <[EMAIL PROTECTED]> wrote: > I am trying to select the most recent cost price for a product, the simple > solution would seem to be... > > SELECT m.Title, LAST(s.cost) AS Cost > FROM main m > JOIN stock s ON (s.ProductID = m.ProductID) > WHERE some conditions > > However the LAST aggregate function seems not to be supported in MSSQL > 2000 > and I don't fancy and upgrade to 2005 just to get this one function. > > Any better ideas anyone? > > -- > Jay > > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.16.0/1137 - Release Date: > 18/11/2007 > 17:15 > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion is delivering applications solutions at at top companies around the world in government. Find out how and where now http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us Archive: http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:246715 Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5