当前位置:网站首页>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
边栏推荐
- 2022年制冷与空调设备运行操作考试练习题及模拟考试
- ansible playbook语法和格式 自动化云计算
- Odoo server setup notes
- 通过流式数据集成实现数据价值(2)
- 203、移出链表元素(链表)
- 101. Symmetric Tree
- 定义链表(链表)
- LeetCode 1249. Minimum Remove to Make Valid Parentheses - FB高频题1
- DBA common SQL statements (1) - overview information
- Chapter 1 Oracle database in memory related concepts (im-1.1)
猜你喜欢
随机推荐
DBA common SQL statements (1) - overview information
2022年上海市安全员C证考试题库及答案
第二章 In-Memory 体系结构 (IM-2.2)
利用多线程按顺序连续输出abc10次
Configuration of LNMP
Longest common front string
JUC concurrent programming 06 -- in-depth analysis of AQS source code of queue synchronizer
DBA common SQL statements (3) - cache, undo, index and wait events
SQL tuning series - SQL performance methodology
203、移出链表元素(链表)
349、两个数组的交集
Function realization of printing page
Sim Api User Guide(7)
SQL调优系列文章之—SQL性能方法论
Windows安装redis并将redis设置成服务开机自启
MapReduce压缩
杰理之系统事件有哪些【篇】
Depth selector
Examination questions and answers of the third batch (main person in charge) of Guangdong safety officer a certificate in 2022
【无标题】