The types and the names of the properties in the anonymous types must match:
new { p1 = q.QOT_SEC_ID, p2 = dpr.DPR_TS }
equals
new { p1 = (decimal)p.PAY_SEC_ID, p2 = p.PAY_DATE }
or if p.PAY_SEC_ID
were an int?
:
new { p1 = (int?)q.QOT_SEC_ID, p2 = dpr.DPR_TS }
equals
new { p1 = p.PAY_SEC_ID, p2 = p.PAY_DATE }
…which will find no matches PAY_SEC_ID
is null
, or
new { p1 = q.QOT_SEC_ID, p2 = dpr.DPR_TS }
equals
new { p1 = p.PAY_SEC_ID.GetValueOrDefault(), p2 = p.PAY_DATE }
…which defaults p1
to 0
when PAY_SEC_ID
is null
and again no match will be found (assuming that ID values will never be 0
).