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: Yosi Greenfield <yosi_at_comhill.com>
Date: Tue, 07 Aug 2001 21:40:08 -0700
Message-ID: <F001.00363A8C.20010807214531@fatcity.com>

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).
Received on Tue Aug 07 2001 - 23:40:08 CDT

Original text of this message

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