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: Creating A Crosstab Query

Re: Creating A Crosstab Query

From: Lothar Armbruester <lothar.armbruester_at_rheingau.netsurf.de>
Date: 1997/11/24
Message-ID: <807.267T319T13922290@rheingau.netsurf.de>#1/1

Abeeda_Mohammed wrote at 21-Nov-97 14:21:30

>The following is the structure of a table :
>inventory_item_id
>Organization_id
>cost_type_id
>summary_resource_id
>description
>item_cost
 

>I want to write a query so that I can get the sum of item_cost for each
>description, i.e the description should appear as a column. I am not sure
>what the description is going to be so I cannot write a SQL stmt. with
>sum(decode.. function to perform this crosstab query.
 

>Is there a way out?

I think, You are looking for the group by clause. Try this:

select sum(item_cost),description
from table
group by description;

>thanks in advance,
 

>Abeeda

CU,
Lothar

--
Lothar Armbrüster       | lothar.armbruester_at_rheingau.netsurf.de
Schulstr. 12            | lothar.armbruester_at_t-online.de
D-65375 Oestrich-Winkel |
Received on Mon Nov 24 1997 - 00:00:00 CST

Original text of this message

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