以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  一个SQL语句报错,求大能解惑!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=44662)

--  作者:jnletao
--  发布时间:2014/1/6 13:24:00
--  一个SQL语句报错,求大能解惑!
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
--  发布时间:2014/1/6 14:24:00
--  
where 1=1 在这里是没有意义的啊,为何要写这么一句?