Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to perform an update between tables

Status
Not open for further replies.

tollbooth

MIS
Sep 20, 2002
9
US
Here is what I'm trying to do:

SQL-query :

UPDATE notfoundinmhimports,mhimports
SET
notfoundinmhimports.found = 'y'
WHERE
notfoundinmhimports.original_sym = mhimports.tradesymbol;

MySQL said:
You have an error in your SQL syntax near 'mhimports
SET
notfoundinmhimports.found = 'y'
WHERE
notfoundinmhimpo' at line 1

Can anyone help me out? Thanks in advance!
 
You can only update one table at a time in MySQL. ______________________________________________________________________
TANSTAAFL!
 
I don't want you to program for me, but are there any ways to get around this in MYSQL?
 
I'm interpreting your update query as (in English):

For every row in notinmhimports, set it's field "found" to the value "y" when that record's field "original_sym" is equal to the field "tradesymbol" in any record of mhimports.


Your update query screams for a subselect, which unfortunately MySQL does not at this time support.

I would cheat. I'd use a programming language to perform a select which matches your WHERE clause, then loop through the results of that query, updating notinmhimports. ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top