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. Database & SysAdmin
  3. Database
  4. LEFT OUTER JOIN leaves rows

LEFT OUTER JOIN leaves rows

Scheduled Pinned Locked Moved Database
database
1 Posts 1 Posters 0 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.
  • K Offline
    K Offline
    Knappen
    wrote on last edited by
    #1

    I have to tables 1: Main table 2: Text table the relation is one to many. If there isent any matches in the text-table i want the post from the main-table My query: (Swedish columname“s) ------------------------------------ SELECT arrProdKat.prod,arrProdKat.lev,arrProdKatText.sprak, rubrik =CASE WHEN(arrProdKatText.sprak is null) THEN arrProdKat.rubrik ELSE arrProdKatText.rubrik END, info =CASE WHEN(arrProdKatText.sprak is null) THEN arrProdKat.info ELSE arrProdKatText.info END FROM arrProdKat LEFT OUTER JOIN arrProdKatText ON arrProdKat.arr=arrProdKatText.arr AND arrProdKat.lev=arrProdKatText.lev AND arrProdKat.prod=arrProdKatText.prod AND arrProdKat.arrKat=arrProdKatText.arrKat WHERE arrProdKat.arr=@arr AND arrProdKat.arrKat=@arrKat AND(arrProdKatText.sprak=@sprak OR arrProdKatText.sprak is null) ------------------------------------------- The result dont find the post in the main-table if ther are child-posts in the text-table, even if they dont equals @sprak.

    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