sql-server - MSSQL 查询框架
问题描述
我有 3 个表,例如 master 和 2 个子表。我正在使用加入条件,但没有达到预期的客户需求。
询问:
select * from(
select a.id as mid,b.id,b.val from ##mastertable a right join ##table1 b
on a.id=b.id ) as c inner join ##table2 d on c.mid=d.id
请提供任何其他方式来获得正确的结果。
解决方案
Try:
Select a.id, b.id, b.val
From (mastertable a
Right Join table1 b
On a.id = b.id)
Inner Join table2 d
On a.id = d.id;
推荐阅读
- extjs - 面板宽度不适合整个空间
- java - ExoPlayer 从自定义数据源访问值
- sql - 当一列具有唯一值时如何删除重复记录
- npm - 如何修复 npm 错误和警告?'npm audit fix' 有效吗?
- java - 简单 XML 框架:回退到未知枚举值的默认值
- discord.js - Discord.js 建议通道代码不起作用
- rest - 如何通过服务名访问rest api(部署在k8集群中)
- list - rbind 具有不同列名的多个 csv 文件 R
- python - 如何在 Python 中生成连接数据图?
- css - Chrome 上的图像溢出网格单元格,Firefox 上的正确外观 - 网格区域和媒体查询