sql - 如何正确使用JOIN
问题描述
解决方案
Your query basically looks right. However, if you want all rows in the first table, then use a LEFT JOIN
:
SELECT pe.sku AS SKU, ev.value AS Description
FROM Product_Entity pe LEFT JOIN
Entity_Varchar ev
ON ev.entity_id = pe.entity_id AND
ev.attribute_id = '73';
Rows that don't match will have NULL
for the description.
推荐阅读
- android - Google Play 管理中心:如何将 Android 应用从 Alpha 升级到 Beta
- routing - IE11 的 Angular6 路由问题
- javascript - 承诺事件全球?
- python - 如何测量两个非线性时间序列数据集之间的相关性
- r - 使用 `withCallingHandlers` 并行出错
- windows - 如何在powershell命令中设置变量
- ruby-on-rails - 无法连接到 Ubuntu 16.04.5 LTS 上的 Rails 服务器
- android - 如何执行 Dagger 2 构造函数、方法、字段注入?
- javascript - 如何使用通过 SELECT 查询获得的数据插入 mysql 数据库?
- javascript - 从多个对象数组创建单个对象数组