mercredi 26 août 2015

Insert Into Select if data is exists in table

Ok, I am using Eclipse with SQLite now.

String query="INSERT INTO Deposit_Payment (Date,DepositNo,TaxInvSimp,TaxInvFull,Dr,Cr) SELECT Date,NoPayment,InvNoSimp,InvNoFull,PaymentDr,PaymentCr FROM Main";

I have to update Deposit_Payment whenever Main is inserted some value.The problem is using this query the same data will be update to Deposit_Payment table.

How can I only update the Deposit_Payment table if the data is not exist in Main table?

Aucun commentaire:

Enregistrer un commentaire