实际上,INTERSECTION 只是所有列的内部联接。我们以两个表为例,数据如下 -
mysql> Select * from value1; +------+------+ | i | j | +------+------+ | 1 | 1 | | 2 | 2 | +------+------+ 2 rows in set (0.00 sec) mysql> Select * from value2; +------+------+ | i | j | +------+------+ | 1 | 1 | | 3 | 3 | +------+------+ 2 rows in set (0.00 sec)
现在,以下查询将在这些表之间进行交集 -
mysql> Select * from value1 join value2 using(i,j); +------+------+ | i | j | +------+------+ | 1 | 1 | +------+------+ 1 row in set (0.08 sec)
以上是如何借助MySQL连接实现表之间的INTERSECTION?的详细内容。更多信息请关注PHP中文网其他相关文章!