请问在mysql中怎么更新前N条记录?
解决方案 »
- 连接远程mysql的问题
- between和<>
- 一条DELETE语句是否可以删除多行记录?
- 关于MySQL中的ODBC与C语言的API的一些问题
- 用RecordsetPtr实例open带有tinyint类型字段的表时查找不到数据,但实际上是有的,请问怎么回事?
- MYSQL导出带中文数据的SQL文件后无法导回来!!高手帮忙呀!
- 插入一条记录时,立即获得该插入的id,不锁定表是否会出错
- 有关查询语句的问题!
- [技巧] mysql 3.22以下版本不支持子查询, 但所有的子查询都可以使用LEFT JOIN 或 and语句替代
- 请DBA大哥帮我解决一下
- mysql使用2个问题
- 如何写让多个相同的数据库自动升级的代码
`aid` int(11) NOT NULL,
`title` varchar(1000) NOT NULL,
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=gb2312
========== select * from a; query result(10 records)
aid title
1 666
2 yyy
3 666
4 343
5 (NU
6 343
7 fgh
8 676
9 yyh
10 rtrt ----------- update a set title = 'csdn ' order by aid desc limit 2;
(2 row(s)affected)
(0 ms taken)
select * from a;
query result(10 records)
aid title
1 666
2 yyy
3 666
4 343
5 (NU
6 343
7 fgh
8 676
9 csdn
10 csdn
---- update a set title = 'csdn ' order by aid asc limit 2 ;
select * from a;
(2 row(s)affected)
(0 ms taken) (10 row(s)returned)
(0 ms taken)
query result(10 records)
aid title
1 csdn
2 csdn
3 666
4 343
5 (NU
6 343
7 fgh
8 676
9 csdn
10 csdn
这是人家以前回答的,你看吧