This is my query:
SELECT *
FROM [dbo].[datamerge]
WHERE Timesheet_Id = 'xxx'
AND AdminType_Id NOT IN (SELECT [ConfigValue]
FROM [dbo].[adf_Config]
WHERE [ConfigKey] = 'NonBillableEntries')
The above query returns 9 rows.
However, if I put in the value of the sub query I get 8 rows as expected:
SELECT *
FROM [dbo].[datamerge]
WHERE Timesheet_Id = 'xxx'
AND AdminType_Id NOT IN (106, 4, 3, 7, 100, 5, 105)
Any idea why this is happening?
EDIT
timesheet_Id AdminType_Id
-----------------------------
16530056441 2033563818
16530056441 2033563818
16530056441 2033563818
16530056441 2033563818
16530056441 101
16530056441 101
16530056441 101
16530056441 101
16530056441 4
This is the table structure and sample data. I am not expecting the last row to be returned by the query.
And the result of the query
SELECT [ConfigValue]
FROM [dbo].[adf_Config]
WHERE [ConfigKey] = 'NonBillableEntries'
is
ConfigValue
106,4,3,7,100,5,105