当前位置:网站首页>SQL learning group by multi table grouping scenario
SQL learning group by multi table grouping scenario
2022-07-05 09:27:00 【Xu Jiajia 233】
scene
There are currently two tables :
Commodity sales history table 、 Commodity information table
The results that need to be output :
Summary of the quantity of goods currently sold .
Example
CREATE TABLE SellCheck (
goods_id string,
sell_number int
);
INSERT INTO SellCheck VALUES
("111",3),
("222",6),
("111",4),
("111",5),
("222",2);
CREATE TABLE GoodsList (
id string,
name string
);
INSERT INTO GoodsList VALUES
("111","AAA"),
("222","BBB");
select Source code
select GoodsList.name as goods_name,sum(SellCheck.sell_number) as goods_sum
from SellCheck
left outer join GoodsList
on GoodsList.id=SellCheck.goods_id
group by goods_name;
Output results
AAA|12
BBB|8
边栏推荐
- 浅谈Label Smoothing技术
- 阿里云发送短信验证码
- High performance spark_ Transformation performance
- The research trend of map based comparative learning (gnn+cl) in the top paper
- Svg optimization by svgo
- It's too difficult to use. Long articles plus pictures and texts will only be written in short articles in the future
- fs. Path module
- 图神经网络+对比学习,下一步去哪?
- Vs code problem: the length of long lines can be configured through "editor.maxtokenizationlinelength"
- Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要
猜你喜欢
High performance spark_ Transformation performance
AUTOSAR from getting started to mastering 100 lectures (103) -dbc file format and creation details
Huber Loss
OpenGL - Lighting
混淆矩阵(Confusion Matrix)
图神经网络+对比学习,下一步去哪?
Nodemon installation and use
Lepton 无损压缩原理及性能分析
Understanding of smt32h7 series DMA and DMAMUX
Wxss template syntax
随机推荐
AUTOSAR from getting started to mastering 100 lectures (103) -dbc file format and creation details
LeetCode 503. 下一个更大元素 II
OpenGL - Coordinate Systems
OpenGL - Coordinate Systems
2311. 小于等于 K 的最长二进制子序列
Applet (use of NPM package)
STM32简易多级菜单(数组查表法)
【PyTorch Bug】RuntimeError: Boolean value of Tensor with more than one value is ambiguous
什么是防火墙?防火墙基础知识讲解
Shutter uses overlay to realize global pop-up
2310. 个位数字为 K 的整数之和
一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
Huber Loss
LeetCode 556. Next bigger element III
信息與熵,你想知道的都在這裏了
Applet (subcontracting)
scipy. misc. imread()
使用el-upload封装得组件怎么清空已上传附件
生成对抗网络
Using request headers to develop multi terminal applications