Order by question

Поиск
Список
Период
Сортировка
Искать

Order by question

От:
Kevin 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

Re: Order by question

От:
"Grzegorz Jaśkiewicz" <gryzman@gmail.com>
Дата:


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

Re: Order by question

От:
Andreas Kretschmer <akretschmer@spamfence.net>
Дата:
Kevin Kempter  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°

Re: Order by question

От:
Thomas Kellerer <spam_eater@gmx.net>
Дата:
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
FAQ