Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 30th, 2009, 02:11 AM
Authorized User
Points: 181, Level: 3
Points: 181, Level: 3 Points: 181, Level: 3 Points: 181, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #2 (permalink)  
Old November 30th, 2009, 10:14 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
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
Reply With Quote
  #3 (permalink)  
Old July 19th, 2011, 09: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
Reply With Quote
  #4 (permalink)  
Old July 19th, 2011, 09: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
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 07:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.