CROSS JOIN
原文:CROSS JOIN
最近在讲到T-SQL查询的Join部分时,一下子没有想起来CROSS JOIN的用法,因为其实平常也确实基本不用到。特意找了一个例子,以供参考
CROSS JOIN又称为笛卡尔乘积,实际上是把两个表乘起来。以下资料摘自:http://www.sqlguides.com/sql_cross_join.php
SQL CROSS JOIN will return all records where each row from the first table is combined with each row from the second table. Which also mean CROSS JOIN returns the Cartesian product of the sets of rows from the joined tables. A CROSS JOIN can be specified in two ways: using the JOIN syntax or by listing the tables in the FROM clause separated by commas without using a WHERE clause to supply join criteria. SQL CROSS JOIN syntax: SELECT * FROM [TABLE 1] CROSS JOIN [TABLE 2] OR SELECT * FROM [TABLE 1], [TABLE 2] EXAMPLE : Let's try with 2 tables below: Table 1: GameScores
Table 2: Departments
SQL statement : SELECT* FROM GameScores CROSS JOIN Departments Result:
|
最新文章
- POJ 3294 二分找超过一半字符串中存在的子串
- jdbc 与 each controller 对多条查询结果的处理
- [问题2015S07] 复旦高等代数 II(14级)每周一题(第八教学周)
- HDU-3548-Enumerate the Triangles
- virgo虚拟桌面
- 解决webApi<;Message>;An error has occurred.<;/Message>;不能写多个Get方法的问题
- [Mime] QuotedPrintableEncoding帮助类 (转载)
- apache2.2版本安装说明
- opencv 学习入门篇
- 【linux】awk相关
- 【安卓进阶】Scroller理解与应用
- 【学习】如何安装GraphLab Create 【转载】
- Oracle 数据库中对记录进行分页处理
- PHP常用180函数总结【初学者必看】
- P2055 [ZJOI2009]假期的宿舍
- Leaflet.draw 无法编辑multipolygon类型多边形 解决方法
- tmux终端复用/tmate终端共享
- Duplicate &;lt;http&;gt; element detected
- [转][访谈]数据大师Olivier Grisel给志向高远的数据科学家的指引
- 王者荣耀交流协会 - 第7次Scrum会议(第二周)