我如何正确创建一个SQL查询,该查询与四个表一起使用公共密钥连接
我有四张桌子,有一个共同点。 四张桌子中的三张是第四张的小子集(主)。 我想加入表格,以便仅输出仅包含主表中的记录,这些记录是其他任何第四个:
我的最终结果应该看起来像:
我的问题是加入我使用的是,只给我所有表所共有的记录。 或只有一个表和主人的记录。
制定正确的加入的任何帮助都很棒!
I have four tables, that have a key in common.
three of the four tables are small subsets of the fourth,(master).
I want to join the tables such that only the output only contains records from the master table, that are on any of other fourth:
My end result should look like this:
My problem is that joins I'm using, are giving me only the records that are common to all tables.
or records that are common to only one of the tables and the master.
Any help on formulating the correct join would be awesome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
三个左连接将产生您想要的结果。例如:
编辑:根据要求添加上面的子句。
Three left joins will produce the result you want. For example:
EDIT: Added WHERE clause above as requested.