MySQL Forums
Forum List  »  Newbie

Re: "Counting" rows
Posted by: Felix Geerinckx
Date: January 03, 2006 05:07AM

Daniel Guerrero wrote:

> as you see the first column is created dynamic and shows the order of the sort, not other
> field; and if this could also decrement in DESC sort mode, it would be terrific.

SELECT @counter := COUNT(*) + 1 FROM yourtable;
SELECT @counter := @counter-1 AS Counter, yourtable.* FROM yourtable ORDER BY yourcolumn;

Please use BBCode to format your messages in this forum.

Options: ReplyQuote

Written By
January 02, 2006 07:20PM
Re: "Counting" rows
January 03, 2006 05:07AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.