我想显示标题在一周之内添加的后面添加一个new表示我写了一条SQL语句,但是有问题大家帮忙看看select ID,On_SupClassid,
On_SupTitle=case
when select * from Support where datediff(day,On_SupTime,getdate())<=7
then On_SupTitle + '[new]'
else On_SupTitle end,
,On_SupSmallPic,On_SupBigPic,On_SupSpec,On_SupContent,On_SupSortId,On_SupEnable,
On_SupIshead,On_SupTime from Support

解决方案 »

  1.   

    select ID,On_SupClassid,
    On_SupTitle=case
    when exists (select * from Support where datediff(day,On_SupTime,getdate())<=7)
    then On_SupTitle + '[new]'
    else On_SupTitle end,
    ,On_SupSmallPic,On_SupBigPic,On_SupSpec,On_SupContent,On_SupSortId,On_SupEnable,
    On_SupIshead,On_SupTime from Support
      

  2.   

    现在所有的标题都变成了后面加了一个new了,是不是我写的判断有问题啊
      

  3.   

    只要在7天之内添加的就在后面加new,其他的不加new
      

  4.   


    select ID,On_SupClassid,
    On_SupTitle=case
    when datediff(day,On_SupTime,getdate())<=7
    then On_SupTitle + '[new]'
    else On_SupTitle end,
    ,On_SupSmallPic,On_SupBigPic,On_SupSpec,On_SupContent,On_SupSortId,On_SupEnable,
    On_SupIshead,On_SupTime from Support