杂谈sql


oracle中关于一些sql的问题


select t1.* from Tplatforminfo t1  where t1.id not in(select t2.platformid from Ttrsplatformtag t2);

select t1.* from Tplatforminfo t1  where not exists(select t2.platformid from Ttrsplatformtag t2 where t2.platformid=t1.id);


not in 与 not exists的区别:
当t1表数量大;t2表的数量少时;not exists效率高
当t1表数量少;t2表的数量多时;not in效率高

猜你喜欢

转载自pnavy.iteye.com/blog/1632424