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 problrm

sql problrm

Scheduled Pinned Locked Moved Database
csharpdatabasec++java
7 Posts 4 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.
  • M Offline
    M Offline
    mahmoudinirat
    wrote on last edited by
    #1

    if have two table like the following: name course ------- --------- mahmoud c++ osam java and the second column as the following: name course1 --------- --------- mahmoud db osama c# najeeb vb.net yahya xml please help me to make the following result name course course1 --------- ---------- ------------ mahmoud c++ null osama java null mahmoud null db osama null c# najeeb null vb.net yahya null xml thank you

    A S V 3 Replies Last reply
    0
    • M mahmoudinirat

      if have two table like the following: name course ------- --------- mahmoud c++ osam java and the second column as the following: name course1 --------- --------- mahmoud db osama c# najeeb vb.net yahya xml please help me to make the following result name course course1 --------- ---------- ------------ mahmoud c++ null osama java null mahmoud null db osama null c# najeeb null vb.net yahya null xml thank you

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      select t1.name, t1.course, t2.course
      from table1 t1
      left outer join table2 t2 on t2.name = t1.name

      (this assumes everyone in table2 is in table)

      Bob Ashfield Consultants Ltd

      M 1 Reply Last reply
      0
      • A Ashfield

        select t1.name, t1.course, t2.course
        from table1 t1
        left outer join table2 t2 on t2.name = t1.name

        (this assumes everyone in table2 is in table)

        Bob Ashfield Consultants Ltd

        M Offline
        M Offline
        mahmoudinirat
        wrote on last edited by
        #3

        the query you sent not return the data as i explained in the result thank you

        A 1 Reply Last reply
        0
        • M mahmoudinirat

          if have two table like the following: name course ------- --------- mahmoud c++ osam java and the second column as the following: name course1 --------- --------- mahmoud db osama c# najeeb vb.net yahya xml please help me to make the following result name course course1 --------- ---------- ------------ mahmoud c++ null osama java null mahmoud null db osama null c# najeeb null vb.net yahya null xml thank you

          S Offline
          S Offline
          shubhi
          wrote on last edited by
          #4

          SELECT * FROM table1 FULL OUTER JOIN table2 ON table1.name = table2.name

          "We can't solve problems by using the same kind of thinking we used when we created them"

          M 1 Reply Last reply
          0
          • S shubhi

            SELECT * FROM table1 FULL OUTER JOIN table2 ON table1.name = table2.name

            "We can't solve problems by using the same kind of thinking we used when we created them"

            M Offline
            M Offline
            mahmoudinirat
            wrote on last edited by
            #5

            the solution is not correct

            1 Reply Last reply
            0
            • M mahmoudinirat

              the query you sent not return the data as i explained in the result thank you

              A Offline
              A Offline
              Ashfield
              wrote on last edited by
              #6

              Well, I did say it assumed all the names in table 2 were in table 1! To be honest, its a rubbish design in the first place, and whoever designed it should be sacked. However, I expect in reality I am doing your homework for you, so here you are: select t1.name, t1.course, t2.course from table_1 t1 left outer join table_2 t2 on t2.name = t1.name union select t2.name, t1.course, t2.course from table_2 t2 left outer join table_1 t1 on t1.name = t2.name where t1.name is null

              Bob Ashfield Consultants Ltd

              1 Reply Last reply
              0
              • M mahmoudinirat

                if have two table like the following: name course ------- --------- mahmoud c++ osam java and the second column as the following: name course1 --------- --------- mahmoud db osama c# najeeb vb.net yahya xml please help me to make the following result name course course1 --------- ---------- ------------ mahmoud c++ null osama java null mahmoud null db osama null c# najeeb null vb.net yahya null xml thank you

                V Offline
                V Offline
                Venkat Eswaran
                wrote on last edited by
                #7

                SELECT b.n, a.c, b.c AS c1 FROM a RIGHT OUTER JOIN b ON a.n = b.n UNION ALL SELECT a.n, a.c, b.c AS Expr1 FROM a LEFT OUTER JOIN b ON a.n = b.n

                Venky

                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