Re: Help with creating a view

From: John Morgan <johnm_at_aaserver.aas.peachnet.edu>
Date: 16 Dec 1993 16:51:22 GMT
Message-ID: <2eq3ma$5f_at_news-feed-2.peachnet.edu>


In article <1993Dec15.140723.548_at_corning.com> , kruger_rc_at_corning.com writes:
> item blue red green black
> ---------------------------------------
> X 1.0 3.0
> Y 4.0 2.0 5.0
>

Try this:
create view color_view
as
(select item,

    sum(decode(type,'BLUE',data,0)) blue,
    sum(decode(type,'RED',data,0)) red,
    sum(decode(type,'GREEN',data,0)) green,
    sum(decode(type,'BLACK',data,0)) black
from color_table
group by item);
---
View and table names were changed to protect my short memory!
Received on Thu Dec 16 1993 - 17:51:22 CET

Original text of this message