I have a linq query with a where clause as below
var ExistingGroupDataSource = (from ppatg in dbContext.XXXXXXXXX
join pd1 in dbContext.XXXXXXXXXXX on ppatg.ScheduleID equals pd1.ScheduleID
where pd1.GroupID == null
select
new
{
FinishPDI = pd1.ProductionDateID,
FinishingDate = pd1.WorkFlowDate,
ppatg.GroupName,
ppatg.PNTGroupID
});
In the database GroupID is an int that can be null. The linq query returns rows without the filtered where clause but none when I include the where clause. There are null values in the GroupId column in the database.
It is definitely this statement that produces no results. All the literature on the subject online says that this is equivalent to
pd1.GroupID is null // in sql
I am getting results that contradict this
Sql code is
select pd1.ProductionDateID as FinishPDI, pd1.WorkflowDate as FinishingDate,GroupName ,PNTGroupId
from XXXXXXXXXXXX
inner join XXXXXXXXXXXX pd1 on
XXXXXXXXXXXX.ScheduleId = pd1.ScheduleID
where pd1.GroupID is null