I have a Table which contains duplicate data in one column. I want to display unique data along with the rownum or serial number. my table has fields table1(tno,tname), in where tname has duplicate values, and I want to display the unique 'tname' data.
Try this:
SET @auto:=0;
SELECT @auto:=@auto+1 rownum, tname
FROM table1 GROUP BY tname