首页 > 数据库技术 > 详细

sql查询 生成列号

时间:2016-08-17 19:41:28      阅读:296      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!