如题。

解决方案 »

  1.   


    select *
      from t1 --主表
     where exists (select 1 from t2 where t1.主键字段 = t2.外键字段);
      

  2.   


    select *
      from t1 --主表
     where exists (select 1 from t2 where t1.主键字段 = t2.外键字段);
      

  3.   

    这个估计需要编才能实现,通过对系统表的查询,然后把得到的列放到数组里面,按照这个数组动态的生成一个SQL文件,最后执行生成的SQL文件
      

  4.   

    不是很明白你想要什么
    假设一张表有A、b、c三个字段,a是主键,那么你是要找b、c都相同的数据?
      

  5.   

    select b,c,d, count(*) from t group by b,c,d having count(*) > 1
      

  6.   


    --应该就是自关联,除主键外各字段比较。
    --比如有a,b,c,d四个字段,a为主键 
    select t1.*
    from table t1
    where exists (select 1 from table t2 where t2.b=t1.b and t2.c=t1.c and t2.d=t1.d)