Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Linq with "not in" and "Count" query

$
0
0

I want a query like 

select count(*) from Table1 where Id not in (Select Id from Table2)


select count(*) from Table1  where Id in (Select Id from Table2)

These in Linq .

I have checked with Contains but i t  gives me runtime error 

var ss = (from reg in db.Table1  where !db.Table2.Contains(reg) select reg).Count();

Please suggest


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>