当前位置:网站首页>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
边栏推荐
- 【PyTorch Bug】RuntimeError: Boolean value of Tensor with more than one value is ambiguous
- 混淆矩阵(Confusion Matrix)
- Wxml template syntax
- Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
- Unity skframework framework (24), avatar controller third person control
- Talking about label smoothing technology
- Analysis of eventbus source code
- 图神经网络+对比学习,下一步去哪?
- . Net service governance flow limiting middleware -fireflysoft RateLimit
- 利用请求头开发多端应用
猜你喜欢
Kotlin introductory notes (V) classes and objects, inheritance, constructors
nodejs_ 01_ fs. readFile
NIPS2021 | 超越GraphCL,GNN+对比学习的节点分类新SOTA
Applet customization component
Editor use of VI and VIM
C form click event did not respond
Rebuild my 3D world [open source] [serialization-1]
22-07-04 西安 尚好房-项目经验总结(01)
C语言-从键盘输入数组二维数组a,将a中3×5矩阵中第3列的元素左移到第0列,第3列以后的每列元素行依次左移,原来左边的各列依次绕到右边
使用el-upload封装得组件怎么清空已上传附件
随机推荐
Can't find the activitymainbinding class? The pit I stepped on when I just learned databinding
Introduction Guide to stereo vision (5): dual camera calibration [no more collection, I charge ~]
Transfer learning and domain adaptation
High performance spark_ Transformation performance
项目实战 | Excel导出功能
Talking about label smoothing technology
一篇文章带你走进cookie,session,Token的世界
np. allclose
C # image difference comparison: image subtraction (pointer method, high speed)
STM32 simple multi-level menu (array table lookup method)
2309. The best English letters with both upper and lower case
Uni app implements global variables
Newton iterative method (solving nonlinear equations)
高性能Spark_transformation性能
Figure neural network + comparative learning, where to go next?
Node collaboration and publishing
Rebuild my 3D world [open source] [serialization-1]
植物大战僵尸Scratch
scipy. misc. imread()
nodejs_ fs. writeFile