From 50ddd5b24e5fa0b2cd1d2d663c38445432b06a84 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 5 Nov 2005 06:45:07 +0000 Subject: [PATCH] --- doc/build/content/sqlconstruction.myt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/build/content/sqlconstruction.myt b/doc/build/content/sqlconstruction.myt index 1e8b0d3411..b5b8ebc15f 100644 --- a/doc/build/content/sqlconstruction.myt +++ b/doc/build/content/sqlconstruction.myt @@ -762,6 +762,23 @@ WHERE users.user_name = :users_user_name AND keywords.name IN ('jack', 'foo') <&|doclib.myt:item, name="correlated", description="Correlated Updates" &> +

A correlated update lets you update a table using selection from another table, or the same table:

+ <&|formatting.myt:code &> + s = select([addresses.c.city], addresses.c.user_id==users.c.user_id) + <&formatting.myt:poplink&>users.update( + and_(users.c.user_id>10, users.c.user_id<20), + values={users.c.user_name:s} + ).execute() + + <&|formatting.myt:codepopper, link="sql" &> + UPDATE users SET user_name=(SELECT addresses.city + FROM addresses + WHERE addresses.user_id = users.user_id) + WHERE users.user_id > :users_user_id AND users.user_id < :users_user_id_1 + {'users_user_id_1': 20, 'users_user_id': 10} + + + <&|doclib.myt:item, name="delete", description="Deletes" &> -- 2.47.2