Re: ORDER BY question

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Luis H(dot)" <pgsql-novice(at)geekhouse(dot)no-ip(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: ORDER BY question
Date: 2003-09-01 07:04:36
Message-ID: 20030901070436.GA28569@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Please don't start new topics by by replying to unrelated messages.

On Sun, Aug 31, 2003 at 21:44:12 -0400,
"Luis H." <pgsql-novice(at)geekhouse(dot)no-ip(dot)com> wrote:
> I have two tables, table A contains users (id, username, password) , and
> table B contains a row that signifies the 'owner' of each particular entry,
> referencing an id in A.
>
> What I want to do is do a query where I order table B by owner, but
> alphabetically by username. The problem, obviously, is that table B only
> contains id's (numbers, indexing to A), which don't correspond to the
> alphabetical order of the usernames.

You should do a join on A and B and then you can order the output by
fields in both A and B.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2003-09-01 07:57:00 Re: ORDER BY question
Previous Message Avi Schwartz 2003-09-01 05:48:23 Re: returning Setof Record