XTQL equivalent of `SELECT * FROM ... WHERE .. IN (...)`

This SQL statement:

SELECT * 
FROM some_table 
WHERE some_column IN ("foo", "bar")

Can be expressed in XTQL as:

(xt/q xt-node
      '(-> (from :some-table [* some-column]) ; `some-column` not required, just for clarity
           (unnest {:search-column $vals})
           (where (= some-column search-column))
           (without :search-column))
      {:args {:vals ["foo" "bar"]}})

Thanks to @refset and @jarohen for this reply in a prior topic.

(Takeaways from Clojurians Slack thread for increased coverage.)

1 Like