Guillaume Lelarge-3 wrote
>> SELECT DISTINCT businessunit AS bu_id,
>> '('||businessunit::TEXT||')'||businessunitname as businessunit FROM
> bug_test
>> ORDER BY businessunit;
>
> It is text. You renamed the second column businessunit.
To be more specific, the ORDER BY chooses an output column name before an
input column name.
http://www.postgresql.org/docs/9.1/static/sql-select.html
"Each expression can be the name or ordinal number of an output column
(SELECT list item), or it can be an arbitrary expression formed from
input-column values."
David J.
--
View this message in context:
http://postgresql.nabble.com/BUG-12603-Results-Ordering-not-correct-tp5834749p5834765.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.