Re: sort by on two columns

From: Adam Ruth <aruth(at)intercation(dot)com>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: "Andy Lewis" <jumboc(at)comcast(dot)net>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: sort by on two columns
Date: 2004-01-03 04:32:51
Message-ID: E473BEC6-3DA5-11D8-89B7-000A959D1424@intercation.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Sounds like you may want to concatenate the columns:

... order by table1.name || table2.name

The sorting would then be performed on both of the them as though they
were one column.

Adam Ruth

On Jan 2, 2004, at 8:04 PM, Michael Glaesemann wrote:

>
> On Jan 2, 2004, at 8:55 PM, Andy Lewis wrote:
>> Yes, I understand this but, I would like to have the results of both
>> "table1.name, table2.name"
>> sorted as one column.
>>
>> Is this possible?
>
> So you want one column of name, including names from both table1 and
> table2? In that case, you need to use UNION, I believe. If it's
> something else, I'm not sure I understand what you're asking. Perhaps
> you could include a sample of what you're getting, along with what
> you'd like to see?
>
> Michael Glaesemann
> grzm myrealbox com
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John Coryat 2004-01-03 09:20:46 Complex Update
Previous Message Chris Travers 2004-01-03 04:05:17 Re: sort by on two columns