Question about SELECT and ORDER BY

Поиск
Список
Период
Сортировка
От Vladimir Terziev
Тема Question about SELECT and ORDER BY
Дата
Msg-id 200002031434.QAA01945@lorna.digsys.bg
обсуждение исходный текст
Ответы Re: [SQL] Question about SELECT and ORDER BY  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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



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

Предыдущее
От: "Mark Hollomon"
Дата:
Сообщение: Re: [HACKERS] Re: [SQL] Proposed Changes to PostgreSQL
Следующее
От: Mark Volpe
Дата:
Сообщение: Re: [SQL] Question about SELECT and ORDER BY