Re: Help of writing a Query involivng horizontal and vertical totals.

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Sat, 08 Jan 2005 08:53:44 -0800
Message-ID: <41e00eea$1_4_at_127.0.0.1>


ashok wrote:

> Dear all,
> I am using the emp like table from the oracle.
> MY requirement is
> 1.
> to calculate the total sum of sal+comm;
> select sal+comm from emp; would only print the results where comm in
> not NULL but I want to display the sal + comm for NULL comm values as
> well (i.e only sal will be displayed for sal + comm ) along with the
> other sal + comm values.
>
> 2.
> alongwith the above requirement , i want the total of only all the sal
> fields (total sal)and total of all the comm fields(total comm).i.e
> vertical total of sal and comm fields.
>
> I have just avergae knowledge of oracle and tried my best to write the
> above related queries but couldn't got the appropriate results.
>
> I request you to kindly help me as I am totally stuck now..
>
>
> regds,
> arj

This is classwork so what help can we give you when you say "I tried my best" but you didn't post anything that would indicate you tried at all.

Post your work and we will provide hints.

The only hint I can give you so far is: GROUP BY.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Sat Jan 08 2005 - 17:53:44 CET

Original text of this message