c# - LINQ or lambda expression with subquery and NOT IN logic -


this question has answer here:

i'm trying wrap head around proper syntax linq query or lambda expression returns equivalent following sql query:

select *  tool t  t.uniqtool    not in (select t1.uniqtool             tool t1           inner join [version] v on v.uniqtool = t1.uniqtool              , v.isbetaversion = 1) 

basically, want list of tools don't have beta version. have tool object has both uniqtool (id value) , boolean property indicating whether version beta.

here initial attempt:

var tools = t in session.cachedtools !t.isbetaversion select t; 

i realized gave me wrong result set , got lost trying figure out subquery not in logic.

thanks!

assuming have navigation property on tool entity query should tools not have version beta:

var tools = session.cachedtools.where(t => !t.versions.any(v => v.isbetaversion == 1)); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -