From: Adria Stembridge Date: January 27 2009 1:38pm Subject: UPDATE ... where max(datecolumn) List-Archive: http://lists.mysql.com/mysql/216039 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e644d53c0e4a1a046176fad8 --0016e644d53c0e4a1a046176fad8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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? --0016e644d53c0e4a1a046176fad8--