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