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