有表A和表B两张表
如何判断表A中包含表B中多少重复的字段数据最后结果只要一个数字

解决方案 »

  1.   

    select count(1)
    from (select a,b,c from tb1 intersect select a,b,c from tb2) as T
      

  2.   

    Select Count(1) As 结果
    From A
    Where Exists(Select 1 from B Where B.关键字=A.关键字)
      

  3.   

    如果我没有理解错误的话:select COUNT(*) from A 
    inner join B on A.字段A1=B.字段B1 and A.字段A2=B.字段B2 and 其他对应字段
      

  4.   

    select count(*) from a inner join b where a.字段1=b.字段1 and a.字段2=b.字段2 and ....
      

  5.   

    如果觉得exists不太好懂,给你上个好懂的select count(1)
    from (
    select id
    from Aintersectselect id
    from B
    ) as t