结果集1
select distinct 关键字段 from 表 :结果集2存在结果集1而不在结果集2中的数据就是结果可以用数据存储或者数据窗口或者直接用一个sql实现

解决方案 »

  1.   

    select * from table group by 关键字 having count(*) >1
      

  2.   

    select 列1,列2 from 表 group by  列1,列2  having count(*)>1
      

  3.   

    select * from 表 where 分组列 in (
    select 分组列 from 表 group by  分组列  having count(*)>1)
      

  4.   

    select * from 表 where 分组列 in (
    select 分组列 from 表 group by  分组列  having count(*)>1)其实这个最好。
      

  5.   

    select * from 表 where 分组列1,分组列2 in (
    select 分组列1,分组列2 from 表 group by  分组列1,分组列3  having count(*)>1)不能成功。
      

  6.   

    写错,呵呵。select * from 表 where 分组列1,分组列2 in (
    select 分组列1,分组列2 from 表 group by  分组列1,分组列2  having count(*)>1)不能成功。
      

  7.   

    select 列1,列2,..... from 表 group by  列1,列2,....  having count(*)>1
    select * from 表 aa where exists (
    select count(*) from 表 bb where aa.分组列1=bb.分组列1 and aa.分组列2=bb.分组列2 and ....)>1
      

  8.   

    查找某字段值重复记录
    select * from table1 a, table1 b
    where a.A<> b.A and a.C=b.C
    其中A为主键,C为要查找重复的字段例如下表:tablename
    P_code   C_code      nameselect * from tablename a tablename b
    where a.P_code<>b.P_code and a. C_code<>b.C_code and a.name=b.name