用存储过程 @result bit output select @maxclicktime=max(clicktime) from table2 where ……set @timebtween=datediff(minute,@maxclicktime,getdate()) if @timebtween>30 begin @result=1 end else begin @result=0 end
我想了一个这样的,不知道是否行得通? Select Table1.关键词,Table1.网址,Table2.关键词,Table2.网址,Table2.点击ip,Table2.点击时间 From Table1,Table2 Where (Table1.关键词<>Table2.关键词) And (Table1.网址<>Table2.网址) And (NowIP<>Table2.点击ip) And ((NowTime-Table2.点击时间)>30)
Select Table1.关键词,Table1.网址,Table2.关键词,Table2.网址,Table2.点击ip,Table2.点击时间 From Table1,Table2 Where (Table1.关键词<>Table2.关键词) And (Table1.网址<>Table2.网址) And (NowIP<>Table2.点击ip) And ((NowTime-Table2.点击时间)>30)不知道是否行得通?
select * from table2 where table2.网址=……… and dateadd(nn,30,table2.点击时间)>getdate()找到记录就放弃,找不到就执行
@result bit output
select @maxclicktime=max(clicktime)
from table2
where
……set @timebtween=datediff(minute,@maxclicktime,getdate())
if @timebtween>30
begin
@result=1
end
else
begin
@result=0
end
Select Table1.关键词,Table1.网址,Table2.关键词,Table2.网址,Table2.点击ip,Table2.点击时间 From Table1,Table2 Where (Table1.关键词<>Table2.关键词) And (Table1.网址<>Table2.网址) And (NowIP<>Table2.点击ip) And ((NowTime-Table2.点击时间)>30)