Don't use 'max', it might be a reserved name in the DBMS.