日期:2014-05-17 浏览次数:20544 次
DECLARE @date datetime DECLARE @diff_date datetime DECLARE @current_date datetime set @current_date = '2012-12-10' set @date = ( SELECT top 1 时间 FROM BuyInformation ORDER BY 时间 DESC ) set @diff_date = @current_date - @date
SELECT * FROM USERINFO WHERE userid IN (SELECT userid FROM BuyInformation WHERE DATEDIFF(day, 时间, GETDATE()) > 30)