# Miscellaneous > Structured Query Language (SQL) >  inner self join?

## Dirk44

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!

----------


## skhanal

Look for PIVOT function if you are using SQL Server.

----------

