数据库更新某整数字段最小的一条数据, 怎么写?
update tabname set field1='value1' where count in (select min(count) from tabname) limit 1;
这一句会提示:You can't specify target table 'tabname' for update in FROM clause....
------解决方案-------------------- update tabname set name='value1' where count in (select * from (select min(count) from tabname ) as t) limit 1;
or
update tabname set field1='value1' ORDER BY count ASC LIMIT 1