[b]
[color=darkblue][size=xx-large][align=center]oracle中关于一些sql的问题[/align][/size][/color]
[/b]
[size=large]select t1.* from Tplatforminfo t1 where t1.id [color=red]not in[/color](select t2.platformid from Ttrsplatformtag t2);
select t1.* from Tplatforminfo t1 where [color=red]not exists[/color](select t2.platformid from Ttrsplatformtag t2 where t2.platformid=t1.id); [/size]
[size=x-large]not in 与 not exists的区别:
当t1表数量大;t2表的数量少时;not exists效率高
当t1表数量少;t2表的数量多时;not in效率高[/size]
[color=darkblue][size=xx-large][align=center]oracle中关于一些sql的问题[/align][/size][/color]
[/b]
[size=large]select t1.* from Tplatforminfo t1 where t1.id [color=red]not in[/color](select t2.platformid from Ttrsplatformtag t2);
select t1.* from Tplatforminfo t1 where [color=red]not exists[/color](select t2.platformid from Ttrsplatformtag t2 where t2.platformid=t1.id); [/size]
[size=x-large]not in 与 not exists的区别:
当t1表数量大;t2表的数量少时;not exists效率高
当t1表数量少;t2表的数量多时;not in效率高[/size]