无详细内容 无 下午被一条SQL折磨了select EMP_ID,EMP_NUM,NAME from employee WHERE emp_id in ( select distinct E.emp_id from EMPLOYEE E INNER JOIN PROJECT_EMPLOYEE pe on e.emp_id = pe.emp_id INNER JOIN PROJECT p on pe.pro_id = p.pro_id where p
<style> .CodeEntity .code_pieces ul.piece_anchor{width:25px;position:absolute;top:25px;left:-30px;z-index:1000;} .CodeEntity .code_pieces ul.piece_anchor li{width:25px;background: #efe;margin-bottom:2px;} .CodeEntity .code_pieces ul.piece_anchor li{border-left:3px #40AA63 solid;border-right:3px #efe solid;} .CodeEntity .code_pieces ul.piece_anchor li:hover{border-right:3px #40AA63 solid;border-left:3px #efe solid;} .CodeEntity .code_pieces ul.piece_anchor li a{color: #333;padding: 3px 10px;} .CodeEntity .code_pieces .jump_to_code{visibility:hidden;position:relative;} .CodeEntity .code_pieces .code_piece:hover .jump_to_code{visibility:visible;} .CodeEntity .code_pieces .code_piece:hover .jump_to_code a{text-decoration:none;} .CodeEntity .code_pieces h2 i{float:right;font-style:normal;font-weight:normal;} .CodeEntity .code_pieces h2 i a{font-size:9pt;background: #FFFFFF;color:#00A;padding: 2px 5px;text-decoration:none;} </style> <!—ecms
- –> <!—ecms
- $velocityCount
–> <!—ecms
–>
下午被一条SQL折磨了select EMP_ID,EMP_NUM,NAME from employee WHERE emp_id in ( select <mark>本文来源gaodaimacom搞#代%码@网-</mark>distinct E.emp_id from EMPLOYEE E INNER JOIN PROJECT_EMPLOYEE pe on e.emp_id = pe.emp_id INNER JOIN PROJECT p on pe.pro_id = p.pro_id where pe.pro_id ='B49CBE19481447A68445461E7BE02B13' );//3条数据因为业务上有变更,需要在此SQL基础上加上一些其他限制,修改后的SQL:select EMP_ID,EMP_NUM,NAME from employee WHERE emp_id in ( select distinct E.emp_id from EMPLOYEE E INNER JOIN PROJECT_EMPLOYEE pe on e.emp_id = pe.emp_id INNER JOIN PROJECT p on pe.pro_id = p.pro_id where pe.pro_id ='B49CBE19481447A68445461E7BE02B13' and e.emp_id not in (select s.emp_id from salesteam s ) );//0条数据,把not in 改成in有1条数据纠结很久,发现是因为not in 后面的查询条件select s.emp_id from salesteam s所返回的数据中存在null的原因解决办法就是将not in的子查询中加上is not null的条件select s.emp_id from salesteam s where s.emp_id is not null