ORDER BY problems

Поиск
Список
Период
Сортировка
От David Shrewsbury
Тема ORDER BY problems
Дата
Msg-id 38ADB0F6.C0608C68@lssi.net
обсуждение исходный текст
Список pgsql-general
I cannot seem to get ORDER BY to work properly when I
want to sort using two different columns. I have code
similar to the following:

SELECT tracking_num, username
FROM reports
WHERE customer='$customer'
ORDER BY tracking_num, username

This will sort by tracking_num (int4, primary key), but
NOT by the username (varchar, not null). The confusing thing
is if I use:

    ORDER BY username, tracking_num

it works, but it sorts by username first and then the
tracking number which is the reverse of what I want to do.
Why doesn't the first bit of code work as I expect?

-David

В списке pgsql-general по дате отправления:

Предыдущее
От: Gary Horton
Дата:
Сообщение: pg general newbie
Следующее
От: "Manuel Lemos"
Дата:
Сообщение: Re: [GENERAL] RE: postgresql and web transactions