Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Field Alias in SQL

Field Alias in SQL

From: Nandakumar <N.Kumar_at_rocketmail.com>
Date: Mon, 30 Aug 1999 22:53:24 GMT
Message-ID: <7qf20v$flo$1@nnrp1.deja.com>


i have a SQL query written as shown below.

select rtrim(substr(upper(email),instr(email,'@',1)), ' '),

           count(rtrim(substr(upper(email),instr(email,'@',1)),' ')) from TABLEA
group by rtrim(substr(upper(email),instr(email,'@',1)),' ') order by 2 desc

the query has the term
 'rtrim(substr(upper(email),instr(email,'@',1),' ')' repeatedly in many places. Is there way to alias this field in its first place and use the alias in the subsequent places?

So the modified query will look like

select rtrim(substr(upper(email),instr(email,'@',1)), ' '),' ') FIELD1, count(FIELD1) from TABLEA group by FIELD1 order by 2;

Thanks in advance for your suggestions! --
Nandakumar
(N.Kumar_at_rocketmail.com)

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Mon Aug 30 1999 - 17:53:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US