SQL Server 2005sales
に列を持つテーブルがあります。ID,paymentType,price
create table sales(id int IDENTITY(1,1),
paymentType varchar(2),
price decimal(10,2) default(0)
)
1 つのクエリでこれを行う方法はありますか?
SELECT SUM(price) as TE
FROM sales
WHERE paymentType = 'E'
SELECT SUM(price) as TC
FROM sales
WHERE paymentType = 'C'