Left outer Join with Group by in Linq RRS feed

  • Question

  • i have problem with this Linq query, it give me wronge result with leftouter join

    return (from x in Table 1 join s in ( (from p in Table 2 where p.b2cblocked == "0" select new { p.Proudct_count p.groupid, } ).Distinct() ).DefaultIfEmpty() on equals s.groupid group new { s, x } by new { x.groupname, } into UP orderby UP.Key.groupname select new Category { TotalItems = UP.Sum(s => s.s.Proudct_count), Name = UP.Key.groupname, Code = } ).Distinct().ToList();
    is it's ok ?

    Sanjay G. Patel
    Thursday, July 9, 2009 11:30 AM


All replies

  • Hi Sanjay

    Can you please explain what you're trying to accomplish with this query - and also replace Table1 and Table2 with nice names.

    Also perhaps, give the SQL for your query - as it's clear that you're transliterating a SQL query into LINQ.

    Someone will then post a solution.


    Write LINQ queries interactively -
    Thursday, July 9, 2009 2:08 PM

  • i have chang request  in  above query.
    Sanjay G. Patel
    • Marked as answer by Sanjay Patel Monday, July 13, 2009 11:33 AM
    Monday, July 13, 2009 11:33 AM