电脑桌面
添加蚂蚁七词文库到电脑桌面
安装后可以在桌面快捷访问

sql语句行转列语句报错

来源:金蝶云社区作者:金蝶2024-09-162

sql语句行转列语句报错

谁帮我看看我写了一个sql语句,看看有什么错误,想实现行转列
select sum(case a.fperiod when 1 then b.famount end)as 1月份,sum(case a.fperiod when 2 then b.famount end)as 2月份,sum(case a.fperiod when 3 then b.famount end)as 3月份,sum(case a.fperiod when 4 then b.famount end)as 4月份,sum(case a.fperiod when 5 then b.famount end)as 5月份,sum(case a.fperiod when 6 then b.famount end)as 6月份,sum(case a.fperiod when 7 then b.famount end)as 7月份,sum(case a.fperiod when 8 then b.famount end)as 8月份,sum(case a.fperiod when 9 then b.famount end)as 9月份,sum(case a.fperiod when 10 then b.famount end)as 10月份,sum(case a.fperiod when 11 then b.famount end)as 11月份,sum(case a.fperiod when 12 then b.famount end)as 12月份 from T_IM_SALEISSUEBILL as a left outer join T_IM_SaleIssueEntry as b on b.FPARENTID=a.FID left outer join T_BD_Material as c on b.FMATERIALID=c.FID left outer join T_SCM_TransactionType as d on d.fid=a.FTransactionTypeID left outer join T_ORG_Storage as e on e.fid=a.FSTORAGEORGUNITID left outer join T_BD_MATERIALGROUP as f on f.fid=c.FMaterialGroupID where (d.fnumber='254' or d.fnumber='243') and a.fyear=2013 group by a.fyear,a.fperiod order by a.fyear asc,a.fperiod asc


错误详细日志如下:
complete! use time: 0 end time: 2014-02-20 11:20:00translate sql exception, message is
parse error. detail message is :
Error
source sql is :
select sum(case a.fperiod when 1 then b.famount end)as 1月份,sum(case a.fperiod when 2 then b.famount end)as 2月份,sum(case a.fperiod when 3 then b.famount end)

sql语句行转列语句报错

谁帮我看看我写了一个sql语句,看看有什么错误,想实现行转列select sum(case a.fperiod when 1 then b.famount end)as 1月份,...
点击下载文档文档为doc格式

声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

已经是第一篇
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息
QQ群
  • 答案:my7c点击这里加入QQ群
支持邮箱
微信
  • 微信