--1、在同一个销售日期如果有多个销售ID时,找出销售金额是一样的全部销售IDselect * from 表 a
where exists( select * from 表 where 销售金额=a.销售金额 and 销售id<>a.销售id and datediff(day,销售日期,a.销售日期))

解决方案 »

  1.   

    --没有注意是ACCESS数据库--1、在同一个销售日期如果有多个销售ID时,找出销售金额是一样的全部销售IDselect * from 表 as a
    where exists( select * from 表 where 销售金额=a.销售金额 and 销售id<>a.销售id and datediff("d",销售日期,a.销售日期)=0)
      

  2.   

    --2、删除其中一个销售ID的记录(只保留重复记录中,销售ID最小的记录)
    delete from 表 as a
    where exists( select * from 表 where 销售金额=a.销售金额 and 销售id<a.销售id and datediff("d",销售日期,a.销售日期)=0)
      

  3.   

    Select b.销售id, 
     b.销售金额,
    b.销售日期
     from Table1 a inner join Table1 b on  a.销售金额=b.销售金额 and datediff(day,a.销售日期,b.销售日期)=0 and a.销售id<>b.销售idwhere b.销售id is not nullgroup by b.销售id, 
    b. 销售金额,
    b.销售日期
      

  4.   

    Select b.销售id, 
     b.销售金额,
    b.销售日期
     from Table1 a inner join Table1 b on  a.销售金额=b.销售金额 and datediff(day,a.销售日期,b.销售日期)=0 and a.销售id<>b.销售idgroup by b.销售id, 
    b. 销售金额,
    b.销售日期
      

  5.   

    2、删除其中一个销售ID的记录(只保留重复记录中,第一个销售ID记录)
    delete from 表 as a
    where 销售id IN( select 销售id from 表 where 销售金额=a.销售金额 and 销售id<>a.销售id and datediff("d",销售日期,a.销售日期)=0)