我有 2 个表 Test1 和 Test1Update 具有以下结构
Test1
id name address
Test1Update
id name address
这里 Test1 是旧表,而 Test1Update 只是 Test1 表的副本我想在这种情况下获取记录,
if(Test1.id=Test1Update.id){
select macthing values from Test1Update tables,and remaining unmatched values from Test1 table
}
else if(Test1.id!=Test1Update.id)
{
select * from Test1 only
}
举个例子
Test1 有类似的数据
Test1
id name address
1 john Ca
2 mary La
and Test1Update has data like
id name address
1 john Las Vega
s
现在我只想从 Test1Update 表中获取匹配的记录,并从表中获取所有不匹配的记录
Test1 table so final output will be
id name address
1 john Las Vegas
2 mary La
这意味着只要找到与 Test1Update 的任何匹配项,就应该替换旧条目。
如何使用选择查询或通过过程来做到这一点?
告诉我一些方法。