Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

547
Views
Cómo consultar la identificación que no está en condición con otra tabla typeorm

Aquí está la consulta

 SELECT * from tableA WHERE tableA.id NOT IN (SELECT tableB.a_id FROM tableB);

¿La misma consulta sobre cómo escribir usando el mecanografiado TypeORM? A continuación se muestra el código, probé que no funciona

 this.createQueryBuilder('tableA') .where(`tableA.id != :id`, { id })
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

const tableBqry = tableBRepository .createQueryBuilder('tableB') .select("tableb_id"); const tableAqry = tableARepository .createQueryBuilder('tableA') .where("tableA.id NOT IN (" + tableBqry.getSql() + ")"); const results = await tableAqry.getMany();

Este método funcionará bien para el problema mencionado anteriormente.

over 4 years ago · Santiago Trujillo Report

0

Puede seleccionar las ID de tableB primero y luego usar las ID que tiene (supongo que están asignadas y almacenadas en var ids: string[] ) para realizar una consulta para tableA .

 this.createQueryBuilder('tableA') .where(`tableA.id <> ALL(:ids)`, { ids })
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!