22,199
社区成员
发帖
与我相关
我的任务
分享
select AdUserId,AdRegId ,AdRegIp,AdTime,LastLogonIP,users.Age
from UserAccounts as users,Adinfo t
where RegType='1' and users.userid=Adinfo.AdRegId
and LastLogonIP!='' and Adtime between '2009-3-26 0:00:00' and '2009-3-27 0:00:00'
and ADSiteID=1001
and not exists(select 1 from Adinfo where Adregid=t.Adregid and Adtime>t.Adtime)
select t.* from tb t where (其他条件) and adtime = (select min(adtime) from tb where (其他条件) and adregid = t.adregig)
select t.* from tb t where (其他条件) and adtime = (select max(adtime) from tb where (其他条件) and adregid = t.adregig)
group by AdRegIp having count(AdRegIp)=1