Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple SQL question...
This looks like the right solution, plus you could put the sum(sal) back in
the first line to get both elements in your output.
Geoff White <whiteg_at_ccis.adisys.com.au> wrote in message
news:372E5262.6A820D3D_at_ccis.adisys.com.au...
> This did the job when I tested it on my temp table
>
> select deptno
> from t1
> group by deptno
> having sum(sal) = (
> select max(sum(sal))
> from t1
> group by deptno)
> /
>
> HTH
>
> Geoff
>
>
> notronrj_at_my-dejanews.com wrote:
>
> > Hello,
> >
> > Got a SQL question. I think it's a simple one, but I am fairly new
> > at SQL. I just took the Intro to SQL from Oracle Education.
> >
> > I have a table "EMP" that contains employess, dept number and salary and
> > other info.
> >
> > I want to write a query that returns the dept with the highest combined
> > salary.
> >
>
> <snip>
>
>
Received on Tue May 04 1999 - 07:50:13 CDT
![]() |
![]() |