Mysql实现rownum Mysql更新update字段为rownum

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';

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值