当前位置:网站首页>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
边栏推荐
- High performance spark_ Transformation performance
- Understanding of smt32h7 series DMA and DMAMUX
- uni-app---uni.navigateTo跳转传参使用
- Nodemon installation and use
- Hi Fun Summer, play SQL planner with starrocks!
- 2310. The number of bits is the sum of integers of K
- Newton iterative method (solving nonlinear equations)
- Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要
- Applet (subcontracting)
- Alibaba's ten-year test brings you into the world of APP testing
猜你喜欢

植物大战僵尸Scratch

Huber Loss

一篇文章带你走进cookie,session,Token的世界

高性能Spark_transformation性能

L'information et l'entropie, tout ce que vous voulez savoir est ici.

Unity skframework framework (24), avatar controller third person control

Introduction Guide to stereo vision (7): stereo matching

项目实战 | Excel导出功能

22-07-04 西安 尚好房-项目经验总结(01)

nodejs_ 01_ fs. readFile
随机推荐
[beauty of algebra] solution method of linear equations ax=0
notepad++
Driver's license physical examination hospital (114-2 hang up the corresponding hospital driver physical examination)
Blogger article navigation (classified, real-time update, permanent top)
迁移学习和域自适应
OpenGL - Coordinate Systems
植物大战僵尸Scratch
A detailed explanation of the general process and the latest research trends of map comparative learning (gnn+cl)
Global configuration tabbar
Huber Loss
Editor use of VI and VIM
【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用
C # image difference comparison: image subtraction (pointer method, high speed)
Composition of applet code
scipy. misc. imread()
. Net service governance flow limiting middleware -fireflysoft RateLimit
An article takes you into the world of cookies, sessions, and tokens
LeetCode 503. 下一个更大元素 II
Generate confrontation network
高性能Spark_transformation性能