Knowledge Walls
John Peter
Pune, Maharashtra, India
SELECT Query Serial no creation in Smart Tricks of MySQL
8270 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;
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details