I'm using MS Sql 2005.
Why does this give me the correct results (returns 169 rows)...
select
*
from
[import_Data]
where
[import_Data].name not in
(
select
[import_Data].name
from
[import_Data]
inner join [resource] on [import_Data].name = [resource].name
where
[import_Data].ProviderTypeID = 4
and [resource].IsDeleted = 0
)
and [import_Data].ProviderTypeID = 4
But this doesn't (returns 0 rows)...
select
*
from
[import_Data]
where
[import_Data].name not in
(
select
[resource].name
from
[resource]
where
IsDeleted = 0
)
and [import_Data].ProviderTypeID = 4
The only difference between the name
columns is that [resource].name
is varchar(500)
and [import_Data].name
is varchar(300)
.