using custom column names in a group by clause - Mailing list pgsql-sql

From mrink@avaya.com (Matt Rinkenberger)
Subject using custom column names in a group by clause
Date
Msg-id 3612a608.0107130833.58902406@posting.google.com
Whole thread Raw
Responses Re: using custom column names in a group by clause
List pgsql-sql
The following select sets two custom column names using the same
original column name.  When I try to include a custom column name in a
group by clause I get ORA-00904: invalid column name from Oracle.  How
can I access a column name I created in the group by clause?

Here's the SQL:  DISP is the column causing the error

select userid,matlid,wsid,
substr(note,instr(note,'Status') + 8,(instr(note,',',1,3) -
(instr(note,'Status') + 8))) as DISP,
sum(substr(note,instr(note,'Qty') + 5,(instr(note,',',1,1) -
(instr(note,'Qty') + 5)))) as QTY,
action
from ise_prodordlog 
where userid = '4500925'
and action in ('CompleteItem','UndoCompleteItem')
and actiontime >= to_date('06/20/2001 00:00:00','MM/DD/YYYY
HH24:MI:SS')
and actiontime < to_date('06/30/2001 00:00:00','MM/DD/YYYY
HH24:MI:SS')
group by userid,matlid,wsid,DISP,action
order by userid,matlid,wsid,DISP,action;

Matt Rinkenberger
Avaya, Inc.
mrink@avaya.com


pgsql-sql by date:

Previous
From: "Chris Ruprecht"
Date:
Subject: First steps in plpgsql - language not recognized?
Next
From: Bhuvan A
Date:
Subject: CAST(ipaddress as text) -- HOW?