Friday, March 23, 2012

ORDER BY DESC

I want to select 3 columns so that the result set is sorted descending on
each column. But this doesn't seem to get me the results that I want:
SELECT col1, col2, col3
FROM tbl1
ORDER BY col1, col2, col3 DESC
And this does not work (syntax error):
...ORDER BY col1 DESC, col2 DESC, col3 DESC
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave MustaneMike,
This should work:
> ...ORDER BY col1 DESC, col2 DESC, col3 DESC
Can you show the actual query?
Andrew J. Kelly SQL MVP
"Mike Labosh" <mlabosh@.hotmail.com> wrote in message
news:urUl$OLBGHA.3164@.TK2MSFTNGP10.phx.gbl...
>I want to select 3 columns so that the result set is sorted descending on
>each column. But this doesn't seem to get me the results that I want:
> SELECT col1, col2, col3
> FROM tbl1
> ORDER BY col1, col2, col3 DESC
> And this does not work (syntax error):
> ...ORDER BY col1 DESC, col2 DESC, col3 DESC
> --
> Peace & happy computing,
> Mike Labosh, MCSD
> "When you kill a man, you're a murderer.
> Kill many, and you're a conqueror.
> Kill them all and you're a god." -- Dave Mustane
>|||> This should work:
Whoops! Nevermind, you are correct. One of the commas in the order by
clause was acidentally a decimal.
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane

No comments:

Post a Comment