Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012
    Posts
    5

    Unanswered: Please help with this sql query

    I have a table that looks like this

    table_a
    Name Staff
    Adam Instructor
    Paul Assistant
    Mary Instructor


    And Another table that looks like this

    table_b
    Name Grade
    Nani A
    Jimi A
    Mari B
    Pete C

    I want to make a query where I can say:
    Select Names, Role from table_a,table_b where ...

    I want all the names from both tables to appear under Names, and data in columns grade and Staff from both table to appear under Role. That is, the output should look like something like this

    Names Role
    Adam Instructor
    Paul Assistant
    Mary Instructor
    Nani A
    Jimi A
    Mari B
    Pete C


    Please can someone help me on how to write such query.
    Last edited by smile4kenny; 10-25-12 at 03:06.

  2. #2
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    994
    Provided Answers: 2
    Check the help file or BOL for the UNION keyword.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •