470,648 Members | 1,564 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

MySQL query question...

I am having trouble writing a query that Select/Joins two tables and updates
a certain rows in table 2 that meet certain criteria in table 1. Should I
use a nested query? Any Suggestions?

Jul 20 '05 #1
2 1224
"IceOnFire" <af@iceonfire.net> wrote in message
news:10*************@corp.supernews.com...
I am having trouble writing a query that Select/Joins two tables and updates a certain rows in table 2 that meet certain criteria in table 1. Should I
use a nested query? Any Suggestions?


According to the docs, MySql has an extension to let you update one more
tables at once while selecting from more tables.

update Table1, Table2
set Table2.the_column = 20
where Table2.table1_id = Table1.id and Table1.the_other_column = 30
Jul 20 '05 #2
"IceOnFire" <af@iceonfire.net> wrote in message
news:10*************@corp.supernews.com...
I am having trouble writing a query that Select/Joins two tables and updates a certain rows in table 2 that meet certain criteria in table 1. Should I
use a nested query? Any Suggestions?


According to the docs, MySql has an extension to let you update one more
tables at once while selecting from more tables.

update Table1, Table2
set Table2.the_column = 20
where Table2.table1_id = Table1.id and Table1.the_other_column = 30
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Bruce A. Julseth | last post: by
reply views Thread by Phil Powell | last post: by
reply views Thread by Russ | last post: by
51 posts views Thread by w_curtis | last post: by
reply views Thread by Murphy | last post: by
39 posts views Thread by Mairhtin O'Feannag | last post: by
8 posts views Thread by Garry | last post: by
10 posts views Thread by Caffeneide | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.