Hi,
I get an error message (cannot have aggregate function in where clause MA_V.ABDAT = MAX(MA_A.ABDAT) AND MA_V.MAN = MA_A.MAN) when I try to execute a query created in MS_SQL.
I've tried to modify the query but always got an error. Maybe is it too simple but I don't see the solution.
Here is the query working fine in MS_SQL:
SELECT (SELECT MA_V.VERT_F
FROM MA_VUNGEN MA_V
WHERE MA_V.ABDAT = MAX(MA_A.ABDAT) AND MA_V.MAN = MA_A.MAN) AS Contrat
FROM MA_VUNGEN AS MA_A
WHERE (MAN = '85557732') AND (ABDAT <= 5103)
GROUP BY MAN;
The purpose of this query is to retrieve the last valid Number according to a date.
ABDAT is a date in numeric format
VERT_F is a number of contract
MAN is the employee number
Any help will be appreciated
Thans for your time.
I get an error message (cannot have aggregate function in where clause MA_V.ABDAT = MAX(MA_A.ABDAT) AND MA_V.MAN = MA_A.MAN) when I try to execute a query created in MS_SQL.
I've tried to modify the query but always got an error. Maybe is it too simple but I don't see the solution.
Here is the query working fine in MS_SQL:
SELECT (SELECT MA_V.VERT_F
FROM MA_VUNGEN MA_V
WHERE MA_V.ABDAT = MAX(MA_A.ABDAT) AND MA_V.MAN = MA_A.MAN) AS Contrat
FROM MA_VUNGEN AS MA_A
WHERE (MAN = '85557732') AND (ABDAT <= 5103)
GROUP BY MAN;
The purpose of this query is to retrieve the last valid Number according to a date.
ABDAT is a date in numeric format
VERT_F is a number of contract
MAN is the employee number
Any help will be appreciated
Thans for your time.