Question about SELECT and ORDER BY

From: "Vladimir Terziev" <vlady(at)school(dot)digsys(dot)bg>
To: pgsql-sql(at)postgresql(dot)org
Subject: Question about SELECT and ORDER BY
Date: 2000-02-03 14:34:31
Message-ID: 200002031434.QAA01945@lorna.digsys.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hi,

I have two tables:

table1 (attr1 text, attr2 int4)

table2 (attr1 text, attr3 int4, attr4 bool)

I have a query:

SELECT table1.attr1 AS ALIAS, attr2 from table1 UNION ALL
SELECT table2.attr1, attr3 from table2 ORDER BY ALIAS;

I that syntax all is OK.
I want to have a result from ORDER BY length(ALIAS), but this is imposible.

When ORDER BY clause is in format ORDER BY length(attr1), the result is not
ORDERED BY length of attr1.

What can I do? Are anybody have an idea?

Vladimir

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Zeugswetter Andreas SB 2000-02-03 15:21:03 AW: [HACKERS] Re: [SQL] Proposed Changes to PostgreSQL
Previous Message Mark Hollomon 2000-02-03 13:40:24 Re: [HACKERS] Re: [SQL] Proposed Changes to PostgreSQL