select a.department,a.code,b.posttype from a cross join b --两个表的笛卡尔积
很有用,谢谢
没有关联id什么的怎么查?
这个应该不叫联查,我错了
@漫天de光: 如果按照你这2个表的结构。是得不到你的查询结果的
你搜索Cross Join就行了。
少数据 没法 查 请给出全部数据
select a.department,a.code,b.PostType from @A a full outer join @B b on 1=1 order by department,PostType
在SQL Server中,有一类连接叫交叉连接(Cross Join),即直接计算笛卡尔乘积