Is it possible to create auto increment id column in mysql view?

后端 未结 4 1719
南笙
南笙 2021-01-18 10:04

I have created a view in MySql. But now my requirement is to create an Id column in that view which should be auto increment.

My current view is:-

CR         


        
4条回答
  •  后悔当初
    2021-01-18 10:51

    You can simulate it with something like this in your SELECT:

    SELECT @rownum:=@rownum+1 AS rownum, dummy.*
    FROM (SELECT @rownum:=0) r, dummy;
    

提交回复
热议问题