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;