Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. left outer joins

left outer joins

Scheduled Pinned Locked Moved LINQ
csharplinq
3 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nilish
    wrote on last edited by
    #1

    Hi, How should i use the left outer joins in LINQ VB.net

    H A 2 Replies Last reply
    0
    • N Nilish

      Hi, How should i use the left outer joins in LINQ VB.net

      H Offline
      H Offline
      Howard Richards
      wrote on last edited by
      #2

      Left outer joins are created using Group Join and the DefaultIfEmpty() Lets say I want all customers and any OrderIDs (even if customer has no orders). Using Northwind datacontext in db:

      Dim query = From c In db.Customers _
      Group Join o in db.Orders _
      On c.CustomerID Equals o.CustomerID _
      Into tmp = Group _
      From t in tmp.DefaultIfEmpty _
      Select New With { _
      .Name = c.CompanyName, _
      .OrderID =If(t is Nothing, _
      "** no order **", _
      CStr(t.OrderID)) }

      The group join creates a list of the orders for each customer. DefaultIfEmpty specifies the outer-join part. This is will return '** no order **' if a customer has no orders, otherwise one row per order. Check out this article[^] for more help.

      'Howard

      1 Reply Last reply
      0
      • N Nilish

        Hi, How should i use the left outer joins in LINQ VB.net

        A Offline
        A Offline
        abdul manzoor
        wrote on last edited by
        #3

        like sql s server

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups