Foxtable(狐表)用户栏目专家坐堂 → 一个SQL语句报错,求大能解惑!


  共有3750人关注过本帖树形打印复制链接

主题:一个SQL语句报错,求大能解惑!

帅哥哟,离线,有人找我吗?
jnletao
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:936 积分:7719 威望:0 精华:0 注册:2013/7/7 13:37:00
一个SQL语句报错,求大能解惑!  发帖心情 Post By:2014/1/6 13:24:00 [只看该作者]

select * from (select sum(Case When colposition=1 Then number1*Sign Else null End) as [a1], sum(Case When colposition=2 Then number1*Sign Else null End) as [a2], sum(Case When colposition=3 Then number1*Sign Else null End) as [a3], Supply, GoodsStyle, GoodsName, Units, ColorName, ColorCode, ColorValue, inPrice, SizeGroup, Sum(Number1*Sign) AS tNum, Sum(Number1*inPrice*Sign) AS tdpMon, Sum(Number1*Price*Sign) AS tMon,Case When Sum(Number1*Sign) is null then 0 Else Sum(Number1*InPrice*Sign)/Sum(Number1*Sign) End AS tPrice FROM vBillDetail where 1=1 and adddate<='2014-01-06' and depotname in ('衣铺二门店','衣铺一门店') GROUP BY Supply, GoodsStyle, GoodsName, Units, ColorName, ColorCode, ColorValue, inPrice, SizeGroup) where 1=1 order by GoodsStyle 



在关键字 'where' 附近有语法错误。

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2014/1/6 14:24:00 [只看该作者]

where 1=1 在这里是没有意义的啊,为何要写这么一句?

 回到顶部