I have a sql statement as
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')
This above query returns no rows.
However, when I remove the sub query, and just use
select t.name, t.company from company t inner join employee e
on t.id = e.emp_id
I get the required rows.
Also, the sub query
select t.name from table1 where t.id='x'
gives rows of data when executed by itself. Is my syntax for the NOT IN
incorrect?