Wednesday, February 25, 2009

How to Number Rows in MySQL

,
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 Xaprb
set @type = ''; set @num = 1; select type, variety, @num := if(@type = type, @num + 1, 1) as row_number, @type := type as dummy from fruits;

1 comments:

  • May 12, 2011 3:36 PM

    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

    delete

Post a Comment

 

Rocky Says Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger