View Full Version : update

07-19-2011, 01:47 PM
id_1 id_2 date
1 2 1
1 2 2
1 3 3

want to update in such way that all id_2 becomes 2 based on fact that
date is minimal at that id_2, within id_1.

How to do that, mysql does not seem to suport min(something) in joins or subselects .

07-19-2011, 04:36 PM
Um... what?

So you want to update that last row, making the "3" a "2" in id_2? And this is based on the value of id_2 where min(date) grouped by id_1?

I would do that with a SELECT query and then an UPDATE query. Any compelling reason you have to do it in one query?