如何在不使用union的情况下在两个表中没有公共字段时编写连接查询 [英] How to write join query when there is no common fields in two tables without using union

查看:437
本文介绍了如何在不使用union的情况下在两个表中没有公共字段时编写连接查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我想知道,如果没有使用联盟的两个表中没有公共字段,如何写连接查询



我尝试了什么:



SELECT Count(*)

从IGN1 T0内部加入OBTN到T0 。没有常见的colm = T1。没有普通的colm



WHERE T0.ItemCode喜欢'ZP%'

Hi All
I want to know,How to Write Join Query When there is no Common Fields in Two Tables Without using Union

What I have tried:

SELECT Count(*)
From IGN1 T0 Inner Join OBTN on T0. No common colm =T1. No common colm

WHERE T0.ItemCode Like 'ZP%'

推荐答案

我建​​议阅读: SQL连接的可视化表示 [ ^ ]



当没有公共列时,连接表的唯一方法是使用交叉连接,但是(!)该连接产生大量记录,因为产生参与加入的表格的笛卡尔积。



有关交叉加入的更多详细信息,请参阅:使用交叉连接 [ ^ ]
I'd suggest to read this: Visual Representation of SQL Joins[^]

When there's no common column, the only way to join tables is to use cross join, but (!) that join produces lots of records, because produces the Cartesian product of the tables involved in the join.

For further details about cross join, please see: Using Cross Joins[^]


这篇关于如何在不使用union的情况下在两个表中没有公共字段时编写连接查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆