
July 17th, 2012, 10:33 AM
|
|
Contributing User
|
|
Join Date: Jan 2003
Location: Paris Uppland
|
|
Code:
Select A.StudentName,
case when row_number() over(partition by A.StudentName
order by B.CourseName) = 1 then
A.TotalEnrolled else 0 end as totalEnrolled,
B.CourseName,
B.Location
from Students A
join StudentCourses B
on A.StudentId = B.StudentId
order
by A.StudentName,
B.CourseName
|