MySQL Forums
Forum List  »  Newbie

Select Driven Insert - Question
Posted by: Vamsikrishna Nadella
Date: February 25, 2009 01:10PM

Hi,

I want to insert from table a into table b compared to table a the values that are not in table b.

The tables are in different schema. The only catch is the uniqueness is driven by Firat name and Last Name combined. Here is my query:

Insert into d1.Names (FName, LName, LastUpdate, UpdatedBy)
(Select Distinct FirstName, LastName from d2.Names where (Firstname, LastName) not in(SELECT Fname, LName FROM d1.`Names`), '2009-02-25 10:00:00', 'vamsi');

It is throwing me a syntax error near '2009-02-25.....

What am i doing wrong?

If i just query the table using the inner sub query

Select Distinct FirstName, LastName from d2.Names where (Firstname, LastName) not in(SELECT Fname, LName FROM d1.`Names`);

That works absolutely fine.

Can anyone help? Thanks.

-- Vamsi



Edited 1 time(s). Last edit at 02/26/2009 02:55PM by Vamsikrishna Nadella.

Options: ReplyQuote


Subject
Written By
Posted
Select Driven Insert - Question
February 25, 2009 01:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.