Click here to Skip to main content
15,921,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've a sql querry having where in clause as well as left join how can i convert it into linq ??


SQL
select a.id,name,displayname,favtcol from
(select * from reportdetails where id in 
(select reportid from ReportAuthorization where role='user' or loginid = 'a') ) as a left join auditreport as b on a.id= b.reportid
Posted

1 solution

SQL
var reportsByAuth =
           from d in
               (from c in rbaDC.ReportDetails
                from d in rbaDC.ReportAuthorizations
                where c.id == (d.reportid) && (d.role == "admin" || d.loginid == "a")
                select new { c.id, c.displayname, c.name })
           join ef in rbaDC.auditreports
               on d.id equals ef.reportid
           select new { d.id,d.displayname,d.name,ef.favtcol };


Can anybody please tell me if this answer is valid?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900