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