【mysql】查询时类似Oracle Rownum的效果


查询时类似Oracle Rownum的效果

SELECT @rowno:=@rowno+1 as rowno,r.* from table_name r ,(select @rowno:=0) t;

快速创建表

下面这条语句可以快速创建包含查询结果的表

create table table_name as select xxx…

联表更新

update t_news a 
    set a.order_num = (select rowno from t_news_1 b 
where 
    b.news_id = a.news_id)

文章作者: zxc
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 zxc !
  目录