Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: [Q]SQL Question
How about select dep, max(salary)-min(salary) difference from table group by dep;
Ng K C Paul wrote:
> I have a table like this:
>
> dep emp salary
> --- --- ------
> 10 1 100
> 10 2 150
> 20 1 220
> 20 2 330
> 30 1 500
> 30 2 600
>
> I want the result like this:
>
> dep difference
> --- ----------
> 10 50
> 20 110
> 30 100
>
> How can I select the result using SQL?
Received on Tue Sep 29 1998 - 00:00:00 CDT