标签:sp bs as sql type nbsp c class rom
1;首先来说in/not in的用法
in/not in是确定单个属性的值是否和给定的值或子查询的值相匹配;
select * from Student s where s.id in(1,2,3); <pre name="code" class="sql"> select * from Student s where s.name in( select distinct name from Project) 2;现在来说exists/not exists的用法 exists/not exists是解决两张表的交集和差集
select * from proj_basic_info p where not exists (select * from proj_basic_info q where p.id=q.id and q.proj_type=1 and q.qy_source='SUAEE') <pre name="code" class="sql"> select * from proj_basic_info p where exists (select * from proj_basic_info q where p.id=q.id and q.proj_type=1 and q.qy_source='SUAEE')
sql中in/not in 和exists/not exists的用法区别
标签:sp bs as sql type nbsp c class rom
原文地址:http://blog.csdn.net/u011079727/article/details/40823107