SQL 日期交差判断
表名:tb_WebSitePromotion
字段1:ID
字段2:WebSiteInfoID 网站编号
字段3:StartDate 生效开始日期
字段4:EndDate 生效结束日期
select a.*from tb_WebSitePromotion as a inner join tb_WebSitePromotion as b on a.WebSiteInfoID=b.WebSiteInfoID and a.ID<>b.ID and ((a.StartDate >=b.StartDate and a.StartDate<isnull(b.EndDate,GETDATE())) or (b.StartDate >=a.StartDate and b.StartDate<isnull(a.EndDate,GETDATE()))) order by a.WebSiteInfoID