请大家帮我改一个SQL语句好吗? 印象中应该把case when改成iif()。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 'and addDate between :StartDate and :EndDate '+不知道是什么开发语言这个里你确定是要 冒号? ACCESS里的判断 是用IIF 是冒号的,是指SQL语句中的变量。 改为iif具体应该怎么改呢?请各位帮我写个完整的好吗?我改的又是提示错误的。 到数第二句'and addDate between :StartDate and :EndDate '+修改为:'and addDate between StartDate and EndDate '+ 'and addDate between :StartDate and :EndDate '+这个应该是对的,我以往都可以使用的,而且是:,删除后提示错误。 应该不会,微软的 between 语法就没有这样定义如果说提示有错误,应该不是这个错误或者你Debug and print SQLStr ,在查询分析器里面执行一下,有问题你再贴出代码,我再帮你看看 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 '; TO:cherry_li这个冒号可能不是微软的事,是delphi的问题?!反正使用冒号是对的,那个提示就是直指StartDate这个变量没有定义TO:you_tube使用您改的代码似乎可以用了!!!!一会回家再测试一下! 如果合并多个表的列 用SQL语句是否可以删除计算机中指定路径的文件 sql语句? 求VB系统中调用存储过程的写法 请 zjcxc(邹建) 老大前来接分!! 光标,求救。 从sql server 数据库取出text类型的列是空值??? Sql Server6.5 传递空间减少的问题? 请教大侠们,解决问题! sqlserver 中如何创建组合查询?求急 SQL多字段的关联及数据重新排列 sqlserver时间的怪异问题,日期跨天
这个里你确定是要 冒号?
IIF
'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 ';
这个冒号可能不是微软的事,是delphi的问题?!反正使用冒号是对的,那个提示就是直指StartDate这个变量没有定义
TO:you_tube
使用您改的代码似乎可以用了!!!!一会回家再测试一下!