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: select distinct on computed column

Re: select distinct on computed column

From: Komix Hui <huikomix_at_dt.com.hk>
Date: 1997/01/09
Message-ID: <32D56AD0.4608@dt.com.hk>#1/1

Alvin Sylvain wrote:
>
> I'm converting an application from Sybase to Oracle and I've run
> into a number of quandries.
>
> This one is performing a "distinct" select on a "computed" column.
>
> Eg:
>
> select distinct name || ' ' || type "nametype"
> from categorytable
>
> Sybase allowed this, altho Oracle seems to not.

One Simple Way is:

 CREATE VIEW V_CategoryTable(NameType) AS

    SELECT Name||' '||Type
      FROM CategoryTable;

and then,

  SELECT DISTINCT NameType
    FROM V_CategoryTable;  

-- 
Hui, Kwok Miu (Xu, Guo Miao)         E-Mail: huikomix_at_dt.com.hk
Assistant MIS Manager                Tel   : (00852)2589 3369
Cho Yang (Hong Kong) Co., Ltd.       Fax   : (00852)2559 3049
Received on Thu Jan 09 1997 - 00:00:00 CST

Original text of this message

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