...

View Full Version : update last record



BubikolRamios
04-08-2009, 08:05 AM
a b text
1 1 t1
1 2 t2
1 3 t3
2 4 t4
...




update table set text = 'sometext'
where a = 1 and b = (select max(b) from table where a = 1)


this does not work -->

You can't specify target table 'table' for update in FROM clause

BubikolRamios
04-08-2009, 08:41 AM
found something that works:



update table set text= 'sometext'
where a= '1'
order by b desc limit 1



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum