老机辛苦运算中,正在尝试按 michael 说的加distinct 另,我把要核对的字段合成了一下,再来看看 update ta set keyword = a+b update tb set keyword = a+bselect count(*) from ta where keyword in (select keyword in tb) 结果等待中
如果要求出有关联的fa,fb 数量的话,用以下语句。Select Count(*) from (select Distinct TA.fa,Ta.fb from TA inner join tb On TA.fa = tb.fa And Ta.fb = tb.fb) A
结果可能比两表数据多,把你的数据和实现的功能贴出来.
select count(*)
from (
select distinct TA.* from TA inner join tb on ta.fa = tb.fa and ta.fb = tb.fb
) a
這樣就好了
这样写依然是85889,结果比ta条数还多
是否两个字段求交集不能这样写?我看到的大部分例子都是一个字段的
功能是实现数据的核对,ta是原数据,tb是核对的依据
tb里面有对应的纪录,ta那边的才有效
tb的确是有可能多条对应ta的。数据量比较大,无法贴出数据来
如何解决?
update ta set keyword = a+b
update tb set keyword = a+bselect count(*) from ta where keyword in (select keyword in tb)
结果等待中
(select Distinct TA.fa,Ta.fb from TA inner join tb On TA.fa = tb.fa And Ta.fb = tb.fb) A
加了distinct 以后的数量为58441
与合成keyword以后做的结果相同,
thanks everyone ,
结帖