UPDATE syntax error

Reply

Join Date: Dec 2004
Posts: 3
Reputation: mikeps is an unknown quantity at this point 
Solved Threads: 0
mikeps mikeps is offline Offline
Newbie Poster

UPDATE syntax error

 
0
  #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
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 44
Reputation: starsunited is an unknown quantity at this point 
Solved Threads: 1
starsunited's Avatar
starsunited starsunited is offline Offline
Light Poster

Re: UPDATE syntax error

 
0
  #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 Quick reply to this message  
Join Date: Dec 2004
Posts: 3
Reputation: mikeps is an unknown quantity at this point 
Solved Threads: 0
mikeps mikeps is offline Offline
Newbie Poster

Re: UPDATE syntax error

 
0
  #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 Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MySQL Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC