Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Field Alias in SQL
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