Hi all
Searched the docs, archives etc. but can't find any reference to this
problem I'm having with ORDER BY used in conjunction with SELECT...AS.
A simplified demonstration:
radius=# SELECT col1 AS testing FROM test ORDER BY testing ASC;
testing
----------
Ordering
Test
This
an
is
(5 rows)
But I need the lowercased ordering result for this column for a
case-insensitivity listing, however I get
radius=# SELECT col1 AS testing FROM test ORDER BY lower(testing) ASC;
ERROR: Attribute "testing" not found
Using the ordinal notation (ie. ORDER BY lower(1) ASC) gives weird results
(in my original query).
I can't use ORDER BY lower(col1) in my original and more complex query as
the column is the result of a function.
What obviousness would I be missing here?
version = 7.3.2
cheers
Jason