SELECT Query Serial no creation in Smart Tricks of MySQL
8445 Views
How to create serial number in SELECT Query?
SET @sno := 0;
SELECT (@sno := @sno + 1) as Sno,roll_no,user_name FROM students;
Or
SELECT (@sno := @sno + 1) as Sno,roll_no,user_name FROM students, (SELECT @sno := 0) as ini;