Hay un error: ERROR: column "invitan" does not exist LINE 25: WHERE n.idnota =invitan ^