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