Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Unix and Oracle

RE: Unix and Oracle

From: Sinardy <sinardyxing_at_bcsis.com>
Date: Tue, 07 Aug 2001 23:13:34 -0700
Message-ID: <F001.00363AF5.20010807230522@fatcity.com>

Hi Yosi,

I have a problem in displaying the content like for Counter = 0 with quite alot of officers with buy and sell

How can I join "buy and sell in the same row in my report" while they are in diffrent row in my database
for example

Officer               count(*) for buy          count (*) for sell
        1111                            20                              10

Thank you

Sinardy

-----Original Message-----
Greenfield
Sent: Wednesday, 8 August 2001 1:46 PM
To: Multiple recipients of list ORACLE-L

How in the world did you come up with a subject line of 'Unix and Oracle?'

I can't help you get that counter column on top of the buy and sell header line, you may want to put its column to the left of Officer, and maybe BREAK on it to not print duplicate values. And you may have to change some formatting to get the columns how and where you want them, and you can try using the TTITLE command to print column headers and not print column headers themselves (SET HEAD OFF).

All that said, as far as the SQL is concerned, here:

SELECT counter, officer,

                sum ( decode ( type,  'BUY', 1, 0) * Price ) Buy,
                sum ( decode ( type,  'SELL', 1, 0) * Price ) Sell
FROM some_table
GROUP BY counter, officer
/

hth,

Yosi

Sinardy wrote:

> Hi all,
>
> I have a table with 3 columns which are Counter, Officer, TYPE, PRICE,
> Counter number 4
> TYPE is only contain either Sell or Buy
> Officer number 4
> price number 11
>
> I want to spool out report with SQL to be like this
> example
>
> Counter : 0
> -----Buy----- -----Sell-----
> Officer
> ==========================================================
> 1111 10 11
> 2222 12 13
> 1212 0 1
> 1213 0 0
>
> Total 22 25
>
> I have a problem combining buy and sell column can someone help me please
>
> Thank you
>
> Sinardy
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Sinardy
> INET: sinardyxing_at_bcsis.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

--
Thanks,

Yosi


---------------------------------------------------------
Yosi Greenfield
Oracle Certified DBA
ygreenfield_at_compuserve.com


--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Yosi Greenfield
  INET: yosi_at_comhill.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Sinardy
  INET: sinardyxing_at_bcsis.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Aug 08 2001 - 01:13:34 CDT

Original text of this message

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