Order by question

Started by Kevin Kempterover 17 years ago4 messagesgeneral
Jump to latest
#1Kevin Kempter
kevink@consistentstate.com

Hi All;

I'm selecting 3 columns. I want to order the results ascending by col1 and
col2 and then descending by col3

Whats the syntax for this?

Thanks in advance

#2Grzegorz Jaśkiewicz
gryzman@gmail.com
In reply to: Kevin Kempter (#1)
Re: Order by question

On Wed, Nov 26, 2008 at 7:46 PM, Kevin Kempter
<kevink@consistentstate.com>wrote:

Hi All;

I'm selecting 3 columns. I want to order the results ascending by col1 and
col2 and then descending by col3

Whats the syntax for this?

select * from foo order by a,b asc, c desc;
?

--
GJ

#3Andreas Kretschmer
akretschmer@spamfence.net
In reply to: Kevin Kempter (#1)
Re: Order by question

Kevin Kempter <kevink@consistentstate.com> schrieb:

Hi All;

I'm selecting 3 columns. I want to order the results ascending by col1 and
col2 and then descending by col3

Whats the syntax for this?

order by col1 asc, col2 asc, col3 desc;

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082�, E 13.56889�

#4Thomas Kellerer
spam_eater@gmx.net
In reply to: Kevin Kempter (#1)
Re: Order by question

Kevin Kempter wrote on 26.11.2008 20:46:

Hi All;

I'm selecting 3 columns. I want to order the results ascending by col1 and
col2 and then descending by col3

Whats the syntax for this?

ORDER BY col1 ASC, col2 ASC, col3 DESC

this is documented in the manual