MySQL Forums
Forum List  »  Knowledge Base

complex update statement
Posted by: Chris Reimann
Date: November 16, 2009 01:31PM

I want to update this table based on a rather complex logic in terms of what UPDATE can handle - as far as I know...

The table ("example") design:
id         MEDIUMINT UNSIGNED
user_id    MEDIUMINT UNSIGNED
isarchived TINYINT   UNSIGNED
more_data_cols...

1) i set them ALL to isarchived = 1

2) per DISTINCT user_id, i want ONLY 1 row to be isarchived = 0.
how do I go about doing that?

Thanks so much!

Options: ReplyQuote


Subject
Views
Written By
Posted
complex update statement
2748
November 16, 2009 01:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.