Click here to Skip to main content
15,906,341 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
This is my query
Please convert to linq
SQL
select j.Sno,j.Title, s.CompanyName  from  CompanyReviews j full outer join Company s
on j.cid=s.Id
where s.Id=98



Thank you...
Posted
Comments
[no name] 5-Jun-14 8:20am    
Please try yourself. We are not a code translation service.
NagaRaju Pesarlanka 5-Jun-14 8:25am    
sorry, I got previouse question answere bit late, Thats why I posted again. I am really sorry.
Ajith K Gatty 5-Jun-14 8:34am    
some already posted solution for your previous question.Kindly check it. If it is not working as per your need please come back.
Good Luck

Have a look at the samples provided at http://www.codeducky.org/sql-queries-in-linq/[^]

Tyr by yourself and if you are struck somewhere, post the code you have tried so that we can help you
 
Share this answer
 
See this query something like below
var query = from j in CompanyReviews
                 join s in Company on j.cid equals s.Id into gj
                 from subpet in gj.DefaultIfEmpty()
     where s.Id=98
                 select new { j.Sno,j.Title, CompanyName= (subpet == null ? String.Empty : subpet.CompanyName) };


Get more details from
msdn: left outer join query[^]
 
Share this answer
 
var query = (from p in CompanyReviews 
 join pa in Company on p.cid equals pa.Id into temp1
 from comp in temp1.DefaultIfEmpty()
 select new { p.Sno, p.Title, comp.CompanyName }).Union(
 from pa2 in Company
 join p2 in CompanyReviews on pa2.Id equals p2.cid into temp2
 from camp in temp2.DefaultIfEmpty()
 select new { camp.Sno, camp.Title, pa2.CompanyName }
Where p.Id=98);
 
Share this answer
 
C#
var reviwdata = from j in context.CompanyReviews
                            join s in context.Companies on new { Cid = (Int32)j.Cid } equals new { Cid = s.Id }
                            where
                            s.Id == compId
                            select new
                            {
                                j.Sno,
                                j.Title,
                                j.Cons,
                                j.Date,
                                j.Rating,
                                j.CorrentOrFormer,
                                j.JobTitle,
                                j.Pros,
                                s.CompanyName
                            };
 
Share this answer
 

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