印象中应该把case when改成iif()。

解决方案 »

  1.   

    'and addDate between :StartDate and :EndDate '+不知道是什么开发语言
    这个里你确定是要 冒号?
      

  2.   

    ACCESS里的判断 是用
    IIF
      

  3.   

    是冒号的,是指SQL语句中的变量。
      

  4.   

    改为iif具体应该怎么改呢?请各位帮我写个完整的好吗?我改的又是提示错误的。
      

  5.   

    到数第二句'and addDate between :StartDate and :EndDate '+修改为:'and addDate between StartDate and EndDate '+
      

  6.   

    'and addDate between :StartDate and :EndDate '+这个应该是对的,我以往都可以使用的,而且是:,删除后提示错误。
      

  7.   

    应该不会,微软的 between 语法就没有这样定义如果说提示有错误,应该不是这个错误或者你Debug and print SQLStr ,在查询分析器里面执行一下,有问题你再贴出代码,我再帮你看看
      

  8.   

    SQLStr := 'select a.CoutName ,'+
                'sum(iif( a.Identifier='+''''+'采购收货'+''''+
                  ' ,b.TNumber , 0 )) as TInNumber,'+
                'sum(iif (a.Identifier='+''''+'采购收货'+''''+
                  ' ,b.Price*b.TNumber ,0 )) as TInMoney,'+
                'sum(iif ( a.Identifier='+''''+'采购退货'+''''+
                  ' ,b.TNumber ,0 )) as TOutNumber,'+
                'sum(iif (  a.Identifier='+''''+'采购退货'+''''+
                  ' ,b.Price*b.TNumber ,0 )) as TOutMoney '+
                'from T_Bill  a,T_BillDetail  b  '+
                'where a.BillCode=b.BillCode '+
                'and addDate between :StartDate and :EndDate '+
                'group by a.CoutName ';
      

  9.   

    TO:cherry_li
    这个冒号可能不是微软的事,是delphi的问题?!反正使用冒号是对的,那个提示就是直指StartDate这个变量没有定义
    TO:you_tube
    使用您改的代码似乎可以用了!!!!一会回家再测试一下!