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. Join

Join

Scheduled Pinned Locked Moved Database
databasec++xmlquestion
4 Posts 3 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.
  • R Offline
    R Offline
    Robert1974
    wrote on last edited by
    #1

    I want to join 5 tables and in that way get returned a schema of 10 columns that I can fetch with a recordset that I have made in C++ for this reason, but if one or more of the tables are empty (with this ID) the returned schema doesn't get 10 columns (or doesn't come at all depending on how you do it) and so I cant fetch it with my recordset. I want those column empty if the row is not there. I know I can declare variables like: select chvName = '' from Person but I dont know if it is empty when I do my sql-string without checking that first. Anybody that is good at Transact-SQL? Robert

    D 1 Reply Last reply
    0
    • R Robert1974

      I want to join 5 tables and in that way get returned a schema of 10 columns that I can fetch with a recordset that I have made in C++ for this reason, but if one or more of the tables are empty (with this ID) the returned schema doesn't get 10 columns (or doesn't come at all depending on how you do it) and so I cant fetch it with my recordset. I want those column empty if the row is not there. I know I can declare variables like: select chvName = '' from Person but I dont know if it is empty when I do my sql-string without checking that first. Anybody that is good at Transact-SQL? Robert

      D Offline
      D Offline
      Dr_X
      wrote on last edited by
      #2

      Select A.Column1, B.Column1 From tblA A, tblB B WHERE A.Column1 *= B.Column1 If B.Column1 does not exist you will return A.Column1's Value and Null for B.Column1's Value. The *= or =* is the same as an inner or outer join in T-SQL. Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

      R J 2 Replies Last reply
      0
      • D Dr_X

        Select A.Column1, B.Column1 From tblA A, tblB B WHERE A.Column1 *= B.Column1 If B.Column1 does not exist you will return A.Column1's Value and Null for B.Column1's Value. The *= or =* is the same as an inner or outer join in T-SQL. Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

        R Offline
        R Offline
        Robert1974
        wrote on last edited by
        #3

        Thank you very much, now it works!

        1 Reply Last reply
        0
        • D Dr_X

          Select A.Column1, B.Column1 From tblA A, tblB B WHERE A.Column1 *= B.Column1 If B.Column1 does not exist you will return A.Column1's Value and Null for B.Column1's Value. The *= or =* is the same as an inner or outer join in T-SQL. Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

          J Offline
          J Offline
          Jeff Varszegi
          wrote on last edited by
          #4

          *= and =* are the same as LEFT JOIN and RIGHT JOIN, no? And I don't think they're supported any more, Microsoft's reason being that they're not in the SQL-92 standard. I'd counsel a newbie to use left and right joins instead. Regards, Jeff Varszegi

          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