最佳实践追加,插入表格。查询

时间:2010-08-14 13:44:21

标签: sql delphi ado

您试图确认更新将数据从表A更新到表B的最佳做法。我有ADOConnection1表Clientes和ADOConnection2表Q_Clientes现在我揉更新

ADOConnection1 Table Clientes \Q_Clientes has the same similar to Clientes only it´s in another Locacion i can call clientes.FieldByName('Localização').text := Q_Clientes.FieldByName('Localização').text; .......................................... .......................................... ..........................................

还是有一种更新Table Clientes的简单方法。

Thank's

2 个答案:

答案 0 :(得分:1)

您可以在查询中执行此操作:

INSERT INTO TABLE1 
(SELECT * FROM TABLE2 T2 
LEFT OUTER JOIN TABLE1 T1 on T2.IDField = T1.IDField 
WHERE T1.SomeOtherField is null)

答案 1 :(得分:1)

根据您连接的数据库,您可以使用类似的功能 UPDATE..FROM(SQL Server)或使用SP。