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
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:246704
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5

Reply via email to