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: Gary SMITH <Gary.Smith_at_cern.ch>
Date: 1997/11/21
Message-ID: <3475959C.2B98EB72@cern.ch>#1/1

Something like:

SELECT
    description,
    SUM(item_cost) sum_cost
FROM
    inventory
GROUP BY description;

Should produce:

description sum_cost
----------- ---------

ITEM1          23.56
ITEM2          45.67

ETC....... This seems a bit simple. What did you mean by crosstab query ??

Regards
Gary Smith

Abeeda_Mohammed_at_xn.xerox.com wrote:

> RDBMS Version: 7.3.2.3.1
> Operating System: NT 4.0
> Product: PL/SQL 2.3.2.3
> Product Version: 2.3.2.3
>
> 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?
>
> thanks in advance,
>
> Abeeda
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet

--
*************************
Gary Smith
CERN, Geneva, Switzerland
Email: Gary.Smith_at_cern.ch
Tel:   +41 22 7678944
*************************
Received on Fri Nov 21 1997 - 00:00:00 CST

Original text of this message

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