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 -> Re: Field Alias in SQL

Re: Field Alias in SQL

From: Kuncoro Tri Atmoko <kuncoro_at_lintasarta.co.id>
Date: Tue, 31 Aug 1999 10:06:52 +0700
Message-ID: <cSNy3.23$405.379@news>


First, I think you should create a view like this:

  create view VIEWA as
  select rtrim(substr(upper(email),instr(email,'@',1)), ' ') FIELD1    from TABLEA;

then you can query the data like :

  select FIELD1, COUNT(FIELD1)
    from VIEWA
  group by FIELD1
  order by 1 desc

Thank's

Kuncoro
Jakarta, Indonesia

Nandakumar <N.Kumar_at_rocketmail.com> wrote in message news:7qf20v$flo$1_at_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 - 22:06:52 CDT

Original text of this message

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