List:General Discussion« Previous MessageNext Message »
From:Adria Stembridge Date:January 27 2009 1:38pm
Subject:UPDATE ... where max(datecolumn)
View as plain text  
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?

Thread
UPDATE ... where max(datecolumn)Adria Stembridge27 Jan
  • Re: UPDATE ... where max(datecolumn)Baron Schwartz31 Jan