sqlserver多表连接查询时and 和where的区别
沫林 2021-01-05 02:26:56 例:
1、select * from tab_1 a inner join tab_2 b on a.id = b.cid and b.name = '张'
2、select * from tab_1 a inner join tab_2 b on a.id = b.cid where b.name = '张'
第一种是在on后面写and,第二种直接写where,我感觉这两种查询出来的结果应该是一样的,都是对查询出来的结果进行筛选,但是执行之后差距很大,有没有大佬能解释一下呢?