MySQL Forums
Forum List  »  Newbie

"Counting" rows
Posted by: Daniel Guerrero
Date: January 02, 2006 07:20PM

Hi fellows, I have this problem, I need to sort a table for some fields, but I need to "count" rows; I mean, I have this data:
first | second | third
aleph | beta | theta
or | and | xor

when I sort by first column I want to have this:
1 | aleph | beta | theta
2 | first | second | third
3 | or | and | xor

when I sort by second column I want:
1 | or | and | xor
2 | aleph | beta | theta
3 | first | second | third

and so on; 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.

This is not hard to do out of this in any programming language, but I want to see if there is a way to do it in SQL not in a programming language.

Thanks in advance

Options: ReplyQuote


Subject
Written By
Posted
"Counting" rows
January 02, 2006 07:20PM
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.