|  | Posted by s on 03/30/06 08:56 
On Tue, 28 Mar 2006 14:33:00 +0800, "McHenry" <mchenry@mchenry.com>wrote:
 
 >I have a table with 3 columns, propertyid, valuationdate & valuation
 >
 >I want to return the most recent valuation for each property, sounds simple
 >but it's not !!
 
 Not knowing what SQL engine you're using or how your table is defined,
 try:
 
 MySQL:
 
 SELECT valuation FROM table WHERE propertyid = 123 ORDER BY
 valuationdate DESC LIMIT 1
 
 MSSQL et al:
 
 SELECT TOP 1 valuation FROM table WHERE propertyid = 123 ORDER BY
 valuationdate DESC
 
 ...hth
 
 --
 <s@guerril.la.ape> (to email, remove .ape)
 --
 [Back to original message] |