Allen 2020-06-06 11:30:02 11087 0 0 0 0

如下:

--创建测试表
create table temp(id int(4),name varchar(20));
--写入数据
insert into temp values (1,"aaa");
insert into temp values (2,"bbb");
insert into temp values (3,"cccc");
insert into temp values (4,"ddd");
insert into temp values (5,"eee");
insert into temp values (6,"fff");
insert into temp values (7,"ggg");
insert into temp values (8,"hhh");
insert into temp values (9,"iii");
insert into temp values (10,"jjjj");
--实现获取行号
select @rownum:=@rownum+1 as rownum,name
from temp,(select @rownum:=0) temp
where @rownum<4

OK!


Tag: Mysql Mysql基础
我也要发一个   ·   返回首页   ·   返回[Mysql]   ·   前一个   ·   下一个
欢迎评论
未登录,
请先 [ 注册 ] or [ 登录 ]
(一分钟即可完成注册!)
返回首页     ·   返回[Mysql]   ·   返回顶部