I have a Select Where In query that isn't working with query builder. I'm stuck, not sure what i'm doing wrong.. It may be a bug or simply my mistake. Would really appreciate some help. .createQueryBuilder("ac") .where("ac.sId = :sId", { sId }) .andWhere("ac.code IN (:codes)", { codes: codes.join(",") }) .getOne(); It translates to SQL... SELECT "ac"."sId" AS "ac_sId", "ac"."code" AS "ac_code" FROM "table" "ac" WHERE "ac"."code" IN ($1) -- PARAMETERS: ["treci"] But no results return. I copied and pasted the SQL in Pgadmin and ran it and it failed. But...once I changed "ac"."code" IN ("treci") to "ac"."code" IN ('treci') it worked. Is there a quote issue?
Activity
[-][Postgres]: Where In Query Issue[/-][+][Postgres]: Where clause issue[/+]added tests for #211 WHERE IN does not work properly
pleerock commentedon Jan 17, 2017
What was the issue?
dcworldwide commentedon Jan 17, 2017
I made a silly mistake with my async test logic, was trying to read a record that didn't exist. 🤦♂️
pleerock commentedon Jan 17, 2017
in your code btw, instead of
{ codes: codes.join(",") }you should just do{ codes: codes }dcworldwide commentedon Jan 17, 2017
Thanks. That's neat. I didnt see an example in the docs for where in queries.
working "github issues > #211 where in query issue"