码迷,mamicode.com
首页 > 数据库 > 详细

sql查询 生成列号

时间:2016-08-17 19:42:55      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:

select @row_num totalcount,1 as pageIndex, 3 as pageSize,result_order.*
from account_report as ar inner join (
select @row_num:=@row_num+1 AS row_num ,a.name as aName,a.transaction_type,r.report_date,r.name as rName,r.submit_time,r.deadline,r.`status`,r.id as reportId
from account a,account_report r ,(SELECT @row_num:=0) AS rowvar
where r.account_id=a.id and a.transaction_type in (2) and r.`status` in (0) and r.`type` in (0)
)
AS result_order on ar.id=result_order.reportId

and result_order.row_num>(3*(1-1)) and result_order.row_num<=(3*1)
order by result_order

 

sql查询 生成列号

标签:

原文地址:http://www.cnblogs.com/dasheng-maritime/p/5781409.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!