标签: sql ms-access
来自具有重复名称的文件
单个名称唯一的文件,但某些字段跨多个列转置。
答案 0 :(得分:2)
您需要条件聚集:
select name, sum(iif(transactiotype = 'Purchase', OrderAmt, 0)) as Purchase, sum(iif(transactiotype = 'Purchase fees', OrderAmt, 0)) as Purchasefees from table t group by name;