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: An SQL question

Re: An SQL question

From: GHouck <hksys_at_teleport.com>
Date: Tue, 11 Aug 1998 05:36:58 GMT
Message-ID: <35CFD877.115C@teleport.com>


Chris Daugherty wrote:
>
> Greetings! I need write SQL to do the following:
> I have a table that has these columns:
>
> EmplID Year Bal_ID Bal_Period
> -----------------------------------------
> 8158 1997 CY 1
> 8158 1997 CY 2
> 8158 1997 CY 3
> 8158 1997 CY 4
> 8158 1998 CY 1
> 8158 1998 CY 2
> 8158 1998 CY 3
> 8158 1998 CY 4
> 8158 1998 CY 5
> 8111 1997 CY 1
> 8111 1997 CY 2
> 8133 1997 CY 1
> 8133 1997 CY 3
>
> I need to pull the maxium Bal_Period for each Year for each EmplID. How
> do I do that?
>

You could try something like:

SELECT MAX(BAL_PERIOD),YEAR,EMP1ID
FROM MYTABLE
GROUP BY YEAR,EMP1ID
ORDER BY YEAR,EMP1ID Yours,  

Geoff Houck
systems hk
hksys_at_teleport.com
http://www.teleport.com/~hksys Received on Tue Aug 11 1998 - 00:36:58 CDT

Original text of this message

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