this is one way:

select balance, sum(amount) the_sum
from table_name
group by balance

/Johan



> -----Ursprungligt meddelande-----
> Fr�n: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]F�r Ferry Situmorang
> Skickat: den 2 april 2002 07:58
> Till: Multiple recipients of list ORACLE-L
> �mne: One sql statement
>
>
> Suppose I have table structure like this:
> amount Numeric(10)
> balance VARCHAR(1)
>
> the balance column can only have one of  'D' or 'C'
>
> I want to sum the amount of Debet and Credit on ONE SQL statement.
> How my SQL statement should be?
>
>
> Ferry Situmorang:
> Using Oracle 8.1.7 Designer 6i R4
> PT Perkebunan Nusantara XIII (Persero)
> Pontianak-Indonesia
> http://www.ptpn13.com
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Ferry Situmorang
>   INET: [EMAIL PROTECTED]
>
> 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: [EMAIL PROTECTED] (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: Johan Malmberg
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to