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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. sql

sql

Scheduled Pinned Locked Moved Database
databasehelp
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
    raj code
    wrote on last edited by
    #1

    Table 1 ------- col1 col2 ------------ 1 1 1 2 Table 2 --------- col1 col3 ----------- 1 a 1 b 1 c 1 d Please help me out in building a query which gives the following output: col1 col2 col3 ----------------- 1 1 a 1 2 b 1 NULL c 1 NULL d Thank u

    C R 2 Replies Last reply
    0
    • R raj code

      Table 1 ------- col1 col2 ------------ 1 1 1 2 Table 2 --------- col1 col3 ----------- 1 a 1 b 1 c 1 d Please help me out in building a query which gives the following output: col1 col2 col3 ----------------- 1 1 a 1 2 b 1 NULL c 1 NULL d Thank u

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      SELECT T2.col1, T1.Col2, T2.Col3
      FROM T1
      RIGHT OUTER JOIN T2 ON T1.Col1 = T2.Col1


      Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

      R 1 Reply Last reply
      0
      • C Colin Angus Mackay

        SELECT T2.col1, T1.Col2, T2.Col3
        FROM T1
        RIGHT OUTER JOIN T2 ON T1.Col1 = T2.Col1


        Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

        R Offline
        R Offline
        raj code
        wrote on last edited by
        #3

        I appreciate ur help. But sorry Colin Angus Mackay it doesnt give the format i wanted,I already tried out all the joins.

        1 Reply Last reply
        0
        • R raj code

          Table 1 ------- col1 col2 ------------ 1 1 1 2 Table 2 --------- col1 col3 ----------- 1 a 1 b 1 c 1 d Please help me out in building a query which gives the following output: col1 col2 col3 ----------------- 1 1 a 1 2 b 1 NULL c 1 NULL d Thank u

          R Offline
          R Offline
          Ron Savage
          wrote on last edited by
          #4

          Hi Raj,

          select
          t2.col1,
          t1.col2,
          t2.col3
          from
          tab2 t2

          LEFT OUTER JOIN tab1 t1
          ON ( t1.col2 = ascii(t2.col3) - 96 )

          Results:
          col1 col2 col3


          1 1 a
          1 2 b
          1 NULL c
          1 NULL d

          Pretty silly way to join data though, I hope it was part of a "puzzle" question and not a serious solution. :-)

          Ron

          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