diff --git a/README.md b/README.md index 5721d38..267c573 100644 --- a/README.md +++ b/README.md @@ -117,16 +117,17 @@ The column values do not have to be literals, they can be nested queries: ```clj (let [user-id 12345 - role-names ["user" "editor"]] + role-name "user"] (-> (insert-into :user_profile_to_role) (values [{:user_profile_id user-id :role_id (-> (select :id) (from :role) - (where [:in :name role-names]))}]) + (where [:= :name role-name]))}]) sql/format)) + => ["INSERT INTO user_profile_to_role (user_profile_id, role_id) - VALUES (12345, (SELECT id FROM role WHERE (name in (?, ?))))" - "user" "editor"] + VALUES (12345, (SELECT id FROM role WHERE name = ?))" + "user"] ``` Updates are possible too (note the double S in `sset` to avoid clashing