Subject Sorting on an aggregate column
Author p3pp3rh3ad
I have a TIB_Query that uses the aggregate function MAX:

SELECT
P.NAME,
P.BIRTHDATE,
MAX(R.RECORDDATE) AS LASTDATE
FROM PATIENT P, RECORDING R
WHERE P.PATNUM = R.PATNUM

I can generate an ordering item for the LASTDATE column, but when I try
to sort the dataset with it, I get Dynamic SQL Error (SQL Error Code = -
206 column unknown LASTDATE). Am I missing something?