dcsimg
Results 1 to 2 of 2

Thread: inner self join?

  1. #1
    Join Date
    May 2015
    Posts
    1

    inner self join?

    I have a database of students that looks in very abridged form like this

    Charlotte gradeA 20
    Charlotte gradeB 13
    Willy gradeA 15
    Willy gradeB 16
    Willy gradeC 17

    where in the first column is the student name, in the second column is the name of the course, and in the third column is the grade. Not every student has taken all courses. I want it ultimately look like

    name gradeA gradeB gradeC
    Charlotte 20 13 .
    Willy 15 16 17

    I thought it would be easy, but after a while it did not look like that. I considered inner self joins but got stuck after a while. Has anyone an idea or a reference of any sort?

    Thanks!

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,912
    Look for PIVOT function if you are using SQL Server.

Posting Permissions

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