Here is the query
SELECT * from tableA WHERE tableA.id NOT IN (SELECT tableB.a_id FROM tableB);
Same query how to write using TypeORM typescript? Below is code, I tried which is not working
this.createQueryBuilder('tableA')
.where(`tableA.id != :id`, { id })
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();
This method will work fine for the above-mentioned problem.