Mysql实现rownum
SELECT @rownum:=@rownum+1 AS rownum, tt.* FROM (SELECT @rownum:=0) r, table_name tt;
mysql实现rownum方法
SELECT @rownum:=@rownum+1 AS rownum, Orderstate.* FROM (SELECT @rownum:=0) r, Orderstate ;
select @rownum:=@rownum+1 AS rownum,tt.* from (SELECT @rownum:=0) r,(select date_format(a.exam_time,'%Y-%m-%d') as exam_time,a.exam_place,a.student_applymodels||'/'||a.student_applymodels_type as student_applymodels,a.student_name,a.student_sex,a.student_id_card,a.examinee_number,a.student_score0,a.exam_hands_on from std_exam_test a where a.enabled_flag=1 and a.exam_table_flag=1 and a.exam_table_id=$P{parameter_table_id2} order by a.exam_time desc,a.created_date desc,a.exam_id) tt
Mysql更新update字段为rownum
-- Mysql实现rownum(Mysql更新update字段为rownum)
set @rownum_mini_shop_goods=0;
update mini_shop_goods a SET a.weighing_num=(select @rownum_mini_shop_goods := @rownum_mini_shop_goods + 1 as nid) where a.enabled_flag=1 and (a.type_code like '25%' or a.type_code like '26%') and a.shop_id='402881e8761e798101761e7a147f0000';