OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
UPDATE ... where max(datecolumn)

From: Adria Stembridge (adrya.stembridgegmail.com)
Date: Tue Jan 27 2009 - 07:38:56 CST


I have a table like this:

ID PRODUCT DATEORDERED
1 5 2005-02-18
2 2 2008-03-13
3 2 2008-11-21
4 6 2009-01-21

A field has been added for current order to this table:

ID PRODUCT DATEORDERED FLAGCURRENT

I need to update all records in the table (about 400,000) so that the most
current order has FLAGCURRENT=1 (else 0). Is there an optimal way of doing
this with a single query?