I am trying to run this query on AS400 and it gives an error message as
Token MAX was not valid. Valid tokens: FOR WITH FETCH ORDER UNION OP..
The Query is
SELECT DM1196PF.DRG_CODE, DM1196PF.DRG_DESC
FROM
DM1196PF
WHERE
RTRIM(DM1196PF.GRPR_NAME) = 'CMS' AND DM1196PF.GRPR_VRSN = SELECT MAX(GRPR_VRSN) AS GRPRVRSN FROM DM1196PF WHERE RTRIM(DM1196PF.GRPR_NAME) = 'CMS' GROUP BY GRPR_NAME, DRG_CODE
Is there any other way to use MAX function for AS400??