日期:2014-05-17 浏览次数:20483 次
DECLARE @FStatDate datetime
DECLARE @FEndDate datetime
SET @FStatDate='2013-5-1'
SET @FEndDate='2013-5-30'
select a.fdate,a.user_no from admin_v4.dbo.view1 a inner join (select a.FDate,a.user_no
from admin_v4.dbo.view1 a where a.FDate>=@FStatDate and a.FDate<=@FEndDate group by a.user_no,a.FDate having count(a.user_no)=2) b on a.user_no=b.user_no and a.fdate=b.fdate
group by a.user_no,a.fdate
SELECT DISTINCT a.fdate,a.user_no
from admin_v4.dbo.view1 a
inner join (
select a.FDate,a.user_no
from admin_v4.dbo.view1 a where a.FDate>=@FStatDate and a.FDate<=@FEndDate
group by a.user_no,a.FDate having count(a.user_no)=2
) b on a.user_no=b.user_no and a.fdate=b.fdate
DECLARE @FStatDate datetime
DECLARE @FEndDate datetime
SET @FStatDate='2013-5-1'
SET @FEndDate='2013-5-30'
SELECT a.fdate,a.user_no
INTO #T_CSDN_ONE
from admin_v4.dbo.view1 a
inner join (
select a.FDate,a.user_no
from admin_v4.dbo.view1 a where a.FDate>=@FStatDate and a.FDate<=@FEndDate
group by a.user_no,a.FDate having count(a.user_no)=2
) b on a.user_no=b.user_no and a.fdate=b.fdate
SELECT a.user_no,a.fdate FROM #T_CSDN_ONE group by a.user_no,a.fdate
DROP Table #T_CSDN_ONE