Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 30th, 2009, 02:11 AM
Authorized User
 
Join Date: Mar 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default mysql multiple update query

UPDATE Table1
SET col6 = t2.col1
FROM Table1 t1
LEFT JOIN Table2 t2 ON(t1.col1=t2.col3 AND t1.col4=5)


The above query not working pls. correct me.

Thanks,
thava
 
Old November 30th, 2009, 10:14 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

First UPDATE query doesn't has FROM clause.
Second even you want to write a SELECT in SET clause query wont execute. Because you can not give target table 'Table1' in the SELECT.
__________________
- Rakesh
http://iam-rakesh.blogspot.com
 
Old July 19th, 2011, 08:42 AM
Registered User
 
Join Date: Jul 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
UPDATE Table1
SET col6 = t2.col1
FROM Table1 t1
LEFT JOIN Table2 t2 ON(t1.col1=t2.col3 AND t1.col4=5)
you can do this thing like this..

Code:

UPDATE Table1 LEFT JOIN Table2 t2 ON(t1.col1=t2.col3 AND t1.col4=5)
SET col6 = t2.col1
 
Old July 19th, 2011, 08:46 AM
Registered User
 
Join Date: Jul 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
UPDATE Table1
SET col6 = t2.col1
FROM Table1 t1
LEFT JOIN Table2 t2 ON(t1.col1=t2.col3 AND t1.col4=5)
you can do this thing like this..

Code:

UPDATE Table1 LEFT JOIN Table2 t2 ON(t1.col1=t2.col3 AND t1.col4=5)
SET col6 = t2.col1
another interting that i found about update is here..

http://developer99.blogspot.com/2011...l-queries.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
update multiple columns in an update statement debbiecoates SQL Server 2000 1 August 17th, 2008 04:01 AM
multiple column update query with Case vinod_yadav1919 SQL Language 4 July 3rd, 2008 06:53 PM
I solved insert query.now see this Update Query. [email protected] VB.NET 2002/2003 Basics 2 September 21st, 2006 12:48 AM
Multiple Joins in Multiple Table Search query pookster Access 4 September 23rd, 2004 03:04 PM
How to do a mysql update using varibles in a query Alex_forever MySQL 5 April 28th, 2004 09:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.