Click here to Skip to main content
15,035,723 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a this solution where i wanted to convert the following T-SQL to linq query

    from #HacksTemp as hck
    left join #TempSource SI  on
    hck.Publication = SI.Spreadpublicationcode AND
    hck.Page = SI.spreadpage AND
    hck.Shot = SI.shotsequence and
    hck.ItemNumberShort = SI.ItemNumberShort
  where si.spreadpublicationcode is null

what i have done so for is
var diff = from c in check
    join s in source on new { c.ItemNumberShort, c.Page, c.Shot, c.Publication } equals new { s.ItemNumberShort, s.Page, s.Shot, s.Publication }
    into di
    from s in di.DefaultIfEmpty()
    where s == null
    select s;

    return diff.ToList<Hack>();

but the out put is very differnt on my T-sql i get 39 rows back but on my linq query it return the full check i.e 8780 raws i am using the data in both are the same

appricate if someone correnct me with what i have missed out in my LINQ


1 solution

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