sql server 中的交叉连接

发布网友

我来回答

4个回答

热心网友

1.概念:没有 WHERE 子句的交叉联接将产生联接所涉及的表的笛卡尔积。第一个表的行数乘以第二个表的行数等于笛卡尔积结果集的大小。(table1和table2交叉连接产生3*3=9条记录)
2.交叉连接:cross join (where...)
3.sql语句
select * from table1 cross join table2 (where ...)

热心网友

我自己写的
看看 不知道能不能帮你
http://hi.baidu.com/begreen/blog/item/99d520ddd3d4b3dd8d1029f3.html

热心网友

select 表名.*,表名.* from stu_info cross join grade

三表的自己考虑下

热心网友

select * from 表1 as a inner join 表2 as b on a.id=b.aid;这是两表联接
select * from 表1 as a inner join 表2 as b on a.id=b.aid inner join 表3 as c on b.id=c.cid;这是三表联接

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com