I want to write following sql in linq.
SELECT COL1, COL2
FROM ( SELECT A.COL1, MAX (NVL (C.COL2, 0)) COL2
FROM TBL1 A
LEFT JOIN TBL2 C
ON NVL (A.COL4, '') = NVL (C.COL4, NVL (A.COL4, ''))
AND NVL (A.COL5, '') = NVL (C.COL5, NVL (A.COL5, ''))
AND NVL (A.COL6, '') = NVL (C.COL6,NVL (A.COL6, ''))
GROUP BY A.COL1)
WHERE COL2 <> 0
I try to write like ;
var aa = from a in tbl1
join c in tbl2on a.col4 ?? "" equals c.col4 ?? (a.col4 ?? "") into ps_jointable
from p in ps_jointable.DefaultIfEmpty()
select new { .. }
I got an “Parantheses can be removed” error in the first condition. After I removed the parantheses I got ‘a’ is inaccessible due to its protection level
How can I write this sql linq in C#?