SQLSERVER中交叉连接Cross-Join的基础用法

SQLSERVER中交叉连接Cross-Join的基础用法

SQLSERVER中交叉连接Cross-Join的基础用法

本期内容:交叉连接cross join的基础用法

/*

基础语法

第一种语法:

常规语法:

select columns from 表1 cross join 表2

--无表连接条件 也就是没有 on 以及后面的等值条件

第二种语法

select columns .... from 表1,表2

从两个表或者多个表连接中返回记录的笛卡尔积

两个表的乘积

a表有10 条数据 b表有20条数据 200

结果集的记录数为 a.count * b.条数

*/

select * from PType

select * from Goods

select * from PType cross join Goods

--常规写法 用cross join 关键字

select * from studentInfo cross join JavaScore

select * from studentInfo ,JavaScore

select COUNT(*) from studentInfo

select COUNT(*) from JavaScore

发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章