sql查询-用例

cwtwac6a  于 2021-08-09  发布在  Java
关注(0)|答案(1)|浏览(266)

对于以下数据:
https://www.dropbox.com/s/nwotc7j2p5mn63a/sample.odt?dl=0
我需要检索shortname作为列而不是行的总和。我怎样才能用case来做呢?
谢谢您。

carvr3hs

carvr3hs1#

我将使用自己的select语句构建每一列。就像这样。试试看。

(select sum(amount) from CurrentData where shortname='Loans') as LoanSum, (select sum(amount) from CurrentData where shortname='W-2') as W-2Sum

相关问题