Z
zhangxh
Unregistered / Unconfirmed
GUEST, unregistred user!
源表 Consumedata
Invoice_NO Depart_Code Tatal_Amount
M0041527 AAA 1000
M0041527 DDD 100
M0041527 XXX 300
M0042527 AAA 100
M0041527 AAA 2000
通过一SQL语句得到如下结果:
Invoice_No AAA DDD XXX
M0041527 3000 100 300
M0042527 100 0 0
环境elphi6+SQl Server 2000
我写的sql语句:
select Invoice_no ,sum(iif(depart_Code="AAA",Total_Amount,0)) as "AAA" ,
sum(iif(depart_Code="DDD",Total_Amount,0)) as "DDD"
From ConsumeData Group By Invoice_no
但运行时报语法错:等号=附近
Invoice_NO Depart_Code Tatal_Amount
M0041527 AAA 1000
M0041527 DDD 100
M0041527 XXX 300
M0042527 AAA 100
M0041527 AAA 2000
通过一SQL语句得到如下结果:
Invoice_No AAA DDD XXX
M0041527 3000 100 300
M0042527 100 0 0
环境elphi6+SQl Server 2000
我写的sql语句:
select Invoice_no ,sum(iif(depart_Code="AAA",Total_Amount,0)) as "AAA" ,
sum(iif(depart_Code="DDD",Total_Amount,0)) as "DDD"
From ConsumeData Group By Invoice_no
但运行时报语法错:等号=附近