Re: Help with group by function

From: GHouck <hksys_at_teleport.com>
Date: Mon, 28 Feb 2000 21:00:08 -0800
Message-ID: <38BB5258.2D8_at_teleport.com>


Tom Deseamus wrote:
>
> Can anyone tell me why this will not compile as a view.
>
> SELECT Max(H.FROM_DATE) AS MaxOfFROM_DATE, E.APPLICANT_ID
> FROM JOB_HISTORY H, EMPLOYMENT_DETAIL E
> GROUP BY E.APPLICANT_ID
> HAVING E.EMPLOYMENT_DETAIL_ID = H.EMPLOYMENT_DETAIL_ID
I think it is because you are using HAVING on a column not in the GROUP BY clause:

This should work:

SELECT Max(H.FROM_DATE) AS MaxOfFROM_DATE, E.APPLICANT_ID FROM JOB_HISTORY H, EMPLOYMENT_DETAIL E
WHERE E.EMPLOYMENT_DETAIL_ID = H.EMPLOYMENT_DETAIL_ID GROUP BY E.APPLICANT_ID Yours,

Geoff Houck
systems hk
hksys_at_teleport.com
http://www.teleport.com/~hksys Received on Tue Feb 29 2000 - 06:00:08 CET

Original text of this message