当前位置:网站首页>mysql同一个表中相同数据怎么合并
mysql同一个表中相同数据怎么合并
2022-04-23 10:16:00 【CSDN问答】
题目是“使用where,显示所有销售货物的名称、销售数量、销售金额 ”,会用到以下两张表。
这是“销售表”:
这是“商品一览表”:
运行结果是这样:
但是这不符合实际需求,怎么将那两个Apple iPhonex合并,变成如下形式:
采纳答案:
就把你的那个sql 套过来。然后groupby一下
select 货名, sum(数量), sum(数量 * 单价)group by 货名
版权声明
本文为[CSDN问答]所创,转载请带上原文链接,感谢
https://ask.csdn.net/questions/7693252
边栏推荐
猜你喜欢
JUC concurrent programming 06 -- in-depth analysis of AQS source code of queue synchronizer
Solve the problem of installing VMware after uninstalling
正大国际讲解道琼斯工业指数到底是什么?
Sim Api User Guide(5)
实践六 Windows操作系统安全攻防
2022年流动式起重机司机考试题库模拟考试平台操作
MapReduce压缩
Sim Api User Guide(6)
101. Symmetric Tree
解决方案架构师的小锦囊 - 架构图的 5 种类型
随机推荐
深度选择器
JVM——》常用参数
DBA常用SQL语句(1)— 概况信息
杰理之更准确地确定异常地址【篇】
209、长度最小的子数组(数组)
SQL tuning series - Introduction to SQL tuning
使用IDEA开发Spark程序
LeetCode-608. 树节点
Ansible cloud computing automation command line compact version
Failureforwardurl and failureurl
Detailed explanation of MapReduce calculation process
Rain produces hundreds of valleys, and all things grow
SQL调优系列文章之—SQL调优简介
LeetCode 1249. Minimum remove to make valid parents - FB high frequency question 1
Exercise questions and simulation test of refrigeration and air conditioning equipment operation test in 2022
What if Jerry's function to locate the corresponding address is not accurate sometimes? [chapter]
Common SQL statements of DBA (6) - daily management
Zhengda international explains what the Dow Jones industrial index is?
一文看懂 LSTM(Long Short-Term Memory)
DBA common SQL statements (5) - latch related