frameworks - Convert SQL statement with "having" clause to Linq -
i've been converting manual sql repository uses sqlcommand , sqlconnection use ef4 , far apart have got stuck trying right sql statement linq.
i've been trying time , i'm not getting right results when run query ( sql coming ef4 crazy ).
here query:
select * [accounts] [a] inner join ( select [a].[id] [accounts] [a] inner join [people] [b] on [a].[personid] = [b].[id] inner join [companies] [d] on [b].[companyid] = [d].[id] left outer join [accountorganizationalunit] [c] on [a].[id] = [c].[accountid] left outer join [organizationalunits] [e] on [c].[organizationalunitid] = [e].[id] [d].[groupid] = @groupid group [a].[id] having sum(case [e].[companyid] when @companyid 1 else 0 end) = 0 ) [t2] on [a].[id] = [t2].[id]
the "having" clause causing trouble cant seem ef4 create similiar sql. @groupid guid , companyid int.
thanks help/guidance how can write in linq! if need more info let me know.
cheers,
richard.
Comments
Post a Comment