【发布时间】:2013-06-17 14:38:33
【问题描述】:
我有一个sql语句
select t.name, t.company from company t inner join employee e
on t.id = e.emp_id
where t.name not in(select t.name from table1 where t.id='x')
以上查询不返回任何行。
但是,当我删除子查询时,只需使用
select t.name, t.company from company t inner join employee e
on t.id = e.emp_id
我得到了所需的行。
还有子查询
select t.name from table1 where t.id='x'
自行执行时提供数据行。我的 NOT IN 语法不正确吗?
【问题讨论】: