50,541
社区成员
发帖
与我相关
我的任务
分享
CREATE TABLE goods(
name text,
type text,
price float
);
插入的数据: select * from goods;
A1|B1|100.0
A1|B1|200.0
A1|B2|50.0
A1|B2|100.0
A2|B1|200.0
A2|B1|300.0
A2|B2|500.0
查询语句: 查询同一名字下同一型号商品的总价值:
select name, type, sum(price) from goods group by name, type;
查询结果:
A1|B1|300.0
A1|B2|150.0
A2|B1|500.0
A2|B2|500.0