SELECT distinct [Taskid] FROM[Dbimg].[dbo].[table1] where Taskid not in (select Taskid from[Dbimg].[dbo].[table1] where ValidationFlag is null)
Please help to convert above sql query in linq c#.
SELECT distinct [Taskid] FROM[Dbimg].[dbo].[table1] where Taskid not in (select Taskid from[Dbimg].[dbo].[table1] where ValidationFlag is null)
Please help to convert above sql query in linq c#.
You can try the below code
db.table1.Where(x => !db.table1.Where(y => y.ValidationFlag == null).Select(z => z.Taskid).Contains(x.TaskId))
.Select(x => x.TaskId).Distinct();
But in your case you can also modify the above LINQ as below as you are using the same table
db.table1.Where(y => y.ValidationFlag != null).Select(z => z.Taskid).Distinct();