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

Home -> Community -> Usenet -> c.d.o.misc -> Re: View to view SQL

Re: View to view SQL

From: mcstock <mcstockx_at_xenquery.com>
Date: Fri, 31 Oct 2003 15:29:30 -0500
Message-ID: <0dGdnUjjUP3MWz-iRVn-jA@comcast.com>


just covered this with a colleage...

select

    ename

    , job
    , hiredate
    , emp.deptno
    , sal
    , ttl_sals

from

    emp
    , (

        select deptno, sum(sal) as ttl_sals
        from emp
        group by deptno
        ) empsals

where

    emp.deptno = empsals.deptno

-- 
Mark C. Stock
email mcstock -> enquery(dot)com
www.enquery.com
(888) 512-2048


"Randy Harris" <randy_at_SpamFree.com> wrote in message
news:9nzob.6741$P%1.5602532_at_newssvr28.news.prodigy.com...

> I'm not very good with SQL and would appreciate some advice.
>
> I have a view in 8.1.7.4 that retrieves nearly a hundred fields from five
> different tables. It's long but simple and straightforward, and has been
> working quite well for some time. I've just been told that I now need to
> also retrieve some SUMs and COUNTs from fields in another table. Rather
> than modifying this view with 100 Group BYs, I wonder if it is feasible to
> create another view that gets the SUMs and COUNTs and then add that view's
> output fields to this view's? Is that a smart way to approach this
problem?
> Is there a better?
>
> Thanks in advance,
> Randy Harris
>
>
Received on Fri Oct 31 2003 - 14:29:30 CST

Original text of this message

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