日期:2014-05-18  浏览次数:20500 次

ACCESS的函数IIf语句怎么改成SQL的
Select Top 1 * From ZN_ad Where IIf(AD_State_radio=1,(now BETWEEN AD_BeginTime and AD_EndTime),-1)=-1 

这名ACCESS语句怎么改成SQL的?

先谢谢了

------解决方案--------------------
SQL code

Select Top 1 * From ZN_ad 
Where (AD_State_radio=1 and now BETWEEN AD_BeginTime and AD_EndTime) or 1 = 1

------解决方案--------------------
SQL code
Select Top 1 * From ZN_ad Where AD_State_radio=1 and getdate() BETWEEN AD_BeginTime and AD_EndTime
or (not (AD_State_radio=1))