thondchen / Bom

0 stars 0 forks source link

mysql select auto increment number #9

Open thondchen opened 7 years ago

thondchen commented 7 years ago

mysql select auto increment number

http://idanny.blogspot.tw/2013/09/mysql-select.html

thondchen commented 7 years ago

http://stackoverflow.com/questions/11861799/mysql-query-to-select-results-with-auto-increment-as-a-new-column-added-in-the-r

thondchen commented 7 years ago

ex:

SELECT @s:=@s+1 serial_number,student_id,student_name,student_avg FROM students, (SELECT @s:= 0) AS s WHERE student_avg > 4;

this is will fail in view, need use uuid_short

thondchen commented 7 years ago

select uuid_short()