Thursday, September 06, 2007

Row ID in Mysql and Using it for Serial Number

SET @rownum := 0;
select @rownum :=@rownum + 1 AS rank,EmpID,EmpName,EmpCity from employeedetails where empname ='kiran'


Carry over a value from previous row.

1 comment:

Unknown said...

do you know how can this logic be encapsulated in a single view? ie:

"Create or Replace View TEST as set @rownum; select ...