ORDER BY problems - Mailing list pgsql-general

From David Shrewsbury
Subject ORDER BY problems
Date
Msg-id 38ADB0F6.C0608C68@lssi.net
Whole thread Raw
List 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 by date:

Previous
From: Gary Horton
Date:
Subject: pg general newbie
Next
From: "Manuel Lemos"
Date:
Subject: Re: [GENERAL] RE: postgresql and web transactions