I was looking for a way to number the row in a sql select result. A search lead me to the following.

How to number rows in MySQL at Xaprbset @type = ''; set @num = 1; select type, variety, @num := if(@type = type, @num + 1, 1) as row_number, @type := type as dummy from fruits;

Thank you so much it was a fantastic help, now to number rows in mysql is definitely easy with the help of your recommendation. Thanks
ReplyDelete