MYSQL update statement databases local & remote

Associate
Joined
18 Oct 2002
Posts
100
Hi

I'm trying to update a local & remote database (i'll get on to this later)

1st tried a simple select statement

Code:
SELECT * FROM [SERVERNAME].[DATABASENAME].[DATABASE_USERNAME].[TABLENAME]
"Query empty"

can't get it to work

I'm using Navicat for queries

here is an example of what I need to do

Code:
update 
remotedb_books ,localdb_books
set 
remotedb_books.quantity=localdb_books.quantity
where
localdb_books.sku=localdb_books.sku

Can someone point me in the right direction

Thanks in advance

Dave
 
You need to do something along the lines of

Code:
UPDATE [REMOTE_TABLE_NAME] 
SET ([COLUMN_NAME1], [COLUMN_NAME2]) =
(SELECT [COLUMN_NAME1], [COLUMN_NAME2]
FROM [LOCAL_TABLE_NAME]
WHERE [LOCAL_TABLE_NAME].ID = [REMOTE_TABLE_NAME].ID)
 
Back
Top Bottom