SET @strsql=N'SELECT count(*) as 点击数,AdListID FROM AdViewLog where ClickDate like '%+@DT+%' group by AdListID order by AdListID'
错在哪里  为什么筛选不出结果

解决方案 »

  1.   

    是不是where ClickDate like '%+@DT+%'这里啊? 这个clickdate应该是时间吧,好奇怪的用法。
      

  2.   

    SET @strsql=N'SELECT count(*) as 点击数 FROM AdViewLog where ClickDate like '%+@DT+%' group by AdListID order by AdListID'
      

  3.   

    SELECT count(*),AdListID 
    FROM AdViewLog 
    where ClickDate like '%2009-7-17%' 
    group by AdListID sql 执行起来都是错的
      

  4.   

    SET @strsql=N'SELECT count(*) as 点击数,AdListID FROM AdViewLog where convert(varchar,ClickDate,120) like '''+@DT+'%'' group by AdListID order by AdListID'正确答案
    结贴
      

  5.   

    SELECT count(*),AdListID  
    FROM AdViewLog  
    where ClickDate=convent(datetime,@DT)  
    group by AdListID