Jump to content


Photo

Update Statement using more than 1 table


  • Please log in to reply
1 reply to this topic

#1 davewatts

davewatts
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 October 2003 - 01:15 PM

This is my first time on the forum and I\'m looking for some kind person to help me.

I have developed some SQL that works in both MS SQL Server and in Sybase. This code has been migrated to run on Mysql and it fails a syntax check.

I have had a look at the manual as regards the syntax for the UPDATE statement and it would appear that you cannot have a FROM clause joining two table. Could you let me know if this is true or if there is a method of how to achieve this without using a from clause.



update player
set POINTS = 3
FROM Player AS PP, Matches AS M
WHERE M.GAMEID = PP.GAMEID
and M.MATCHID = PP.MATCHID
and M.RESULTIND = PP.RESULTIND
and PP.IND = \'N\'

#2 DylanBlitz

DylanBlitz
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts
  • LocationOC Baby!

Posted 21 October 2003 - 06:52 PM

depends on the version of mysql. With mysql 4.0.4 and newer you can, older ones have to have seperate update statements. Check this out

http://www.mysql.com.../en/UPDATE.html




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users