» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > MySQL Forums

MySQL Forums Share Your Ideas and Tips about MYSQL. Ask questions about MYSQL. Table Design and Much More...

Reply
 
Thread Tools Display Modes
  #1  
Old 12-12-2006, 04:38 AM
Lias Lias is offline
Junior Member
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Lias is on a distinguished road
Default single set clause..

Hello all,
I'm looking for a feature whereby multiple columns can be updated with a single SET clause such as:
UPDATE tab1 SET (col1, col2, col3) = (SELECT col4, col5, col6 FROM tab2 WHERE tab2.col1 = tab1.col1);
I don't find this feature documented for MySQL. How to accomplish it, any idea?
Thank you. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 12-12-2006, 04:39 AM
evy evy is offline
Senior Member
 
Join Date: Oct 2006
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 16
evy is on a distinguished road
Default

UPDATE tab1 AS t1
JOIN tab2 AS t2 ON tab1.col1 = tab2.col1
SET t1.col1 = t2.col4,
t1.col2 = t2.col5,
t1.col3 = t2.col6; -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
writing a single statement? Bobb MySQL Forums 1 12-23-2006 04:51 AM
AMD single.. or AMD X2...? Sypert Dedicated Servers 1 11-08-2006 03:56 AM
Z555 Launches a Single Unlimited Plan outsourcingplans Web Hosting News 0 10-14-2006 04:20 AM


All times are GMT. The time now is 09:01 PM.