将一个MySQL表的ID名称加入另一个MySQL表中的ID(Join ID names of one MySQL table to IDs in another)
将一个MySQL表的ID名称加入另一个MySQL表中的ID(Join ID names of one MySQL table to IDs in another)
我有一个客户端详细信息表,由ID标识,如下所示:
ID (the clientcode), ame, Details
我想从另一个表中引用带有销售信息的ID,并在查询中选择客户端的名称。
将一个MySQL表的ID名称加入另一个MySQL表中的ID(Join ID names of one MySQL table to IDs in another)
我有一个客户端详细信息表,由ID标识,如下所示:
ID (the clientcode), ame, Details我想从另一个表中引用带有销售信息的ID,并在查询中选择客户端的名称。
我只获取ID(客户端代码)的原始查询字符串是:
SELECT clientcode, SUM(sales) FROM inventory WHERE manufacturer='1' GROUP BY client code ORDER BY SUM(sales) DESC我还想拿起客户端代码引用的客户端的名称。
我尝试了几个LEFT JOI但无法使查询正常工作。
I have one table of client details identified by an ID that looks like this:
ID (the clientcode), ame, DetailsI would like to reference the ID from another table with sales information and pick up the name of the client in the query.
My original query string that picked up just the ID (clientcode) is this:
SELECT clientcode, SUM(sales) FROM inventory WHERE manufacturer='1' GROUP BY client code ORDER BY SUM(sales) DESCI would like to also pick up the ame of the client referenced by clientcode.
I tried a few LEFT JOIs but couldn't get the queries working.
最满意答案
SELECT , , SUM(i.sales) FROM inventory i LEFT JOI clientdetails c O c.id = WHERE ='1' GROUP BY , ORDER BY SUM(i.sales) DESC SELECT , , SUM(i.sales) FROM inventory i LEFT JOI clientdetails c O c.id = WHERE ='1' GROUP BY , ORDER BY SUM(i.sales) DESC#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
上传时间: 2023-04-10 00:18:09
上一篇:linux之vim编辑神器
下一篇:vim 跳转命令
推荐阅读
留言与评论(共有 16 条评论) |
本站网友 胶南二手房信息 | 9分钟前 发表 |
ID (the clientcode) | |
本站网友 虎头蛇尾的意思 | 27分钟前 发表 |
将一个MySQL表的ID名称加入另一个MySQL表中的ID(Join ID names of one MySQL table to IDs in another) 我有一个客户端详细信息表 | |
本站网友 黄文欢 | 12分钟前 发表 |
SUM(i.sales) FROM inventory i LEFT JOI clientdetails c O c.id = WHERE ='1' GROUP BY | |
本站网友 删除微软拼音输入法 | 13分钟前 发表 |
由ID标识 | |
本站网友 网络秘书 | 3分钟前 发表 |
由ID标识 | |
本站网友 铜仁民族风情园 | 25分钟前 发表 |
ID (the clientcode) | |
本站网友 男人为什么喜欢吃奶 | 27分钟前 发表 |
将一个MySQL表的ID名称加入另一个MySQL表中的ID(Join ID names of one MySQL table to IDs in another) 我有一个客户端详细信息表 | |
本站网友 成都2手房 | 8分钟前 发表 |
由ID标识 | |
本站网友 山湖 | 25分钟前 发表 |
ID (the clientcode) | |
本站网友 357游戏 | 11分钟前 发表 |
ID (the clientcode) | |
本站网友 泰山旅游路线 | 29分钟前 发表 |
Details 我想从另一个表中引用带有销售信息的ID | |
本站网友 男性健康小知识 | 0秒前 发表 |
我尝试了几个LEFT JOI但无法使查询正常工作 | |
本站网友 仙桃房网 | 19分钟前 发表 |
SUM(i.sales) FROM inventory i LEFT JOI clientdetails c O c.id = WHERE ='1' GROUP BY | |
本站网友 九眼桥二手房 | 15分钟前 发表 |
ID (the clientcode) | |
本站网友 绿萝花茶 | 22分钟前 发表 |
由ID标识 |