User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 426,898 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,359 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 6091 | Replies: 2
Reply
Join Date: Dec 2004
Posts: 3
Reputation: mikeps is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mikeps mikeps is offline Offline
Newbie Poster

Help UPDATE syntax error

  #1  
Dec 3rd, 2004
I am getting a syntax error report from an UPDATE using two tables in a MYSQL db. :cry: This must be my mistake but I can't see it and have changed around many times now. Any ideas to help me resolve this welcome.

Statement:
UPDATE hole,tee SET hole.hx=tee.tnx where hole.hid=tee.hid;

Error Report:
error in your SQL syntax near 'tee SET hole.hx=tee.tnx where hole.hid=tee.hid' at line 1

Server:
Server running version 4.3.8 of PHP on the Linux operating system
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: Singapore
Posts: 44
Reputation: starsunited is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
starsunited's Avatar
starsunited starsunited is offline Offline
Light Poster

Re: UPDATE syntax error

  #2  
Dec 9th, 2004
Originally Posted by mikeps
I am getting a syntax error report from an UPDATE using two tables in a MYSQL db. :cry: This must be my mistake but I can't see it and have changed around many times now. Any ideas to help me resolve this welcome.

Statement:
UPDATE hole,tee SET hole.hx=tee.tnx where hole.hid=tee.hid;

Error Report:
error in your SQL syntax near 'tee SET hole.hx=tee.tnx where hole.hid=tee.hid' at line 1

Server:
Server running version 4.3.8 of PHP on the Linux operating system

you want to update two tables at one go?
Reply With Quote  
Join Date: Dec 2004
Posts: 3
Reputation: mikeps is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mikeps mikeps is offline Offline
Newbie Poster

Re: UPDATE syntax error

  #3  
Dec 10th, 2004
Originally Posted by starsunited
you want to update two tables at one go?


I have used two queries to get round it but I want to use one. It only updates one table but it uses another table in the condition. In the syntax I think it is called a multi-tabe update. I think you could extend the syntax to update fields in both tables but I just used the simple case to make the post so the problem was clear.

I tried the update on a local server and it worked so I am wondering if the error message is mis-leading?

Thanks for your post.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 10:53 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC