> I am trying to get a pivoted result from a query. The
> pivoting works, however I want to eliminate
> some of the rows, which have no value at all in every
> column but the name column.
Maybe something like:
SELECT * from (
SELECT students.name,
( SELECT score FROM scores
WHERE (
students.name = scores.name
AND
scores.exam = 'first'
AND
scores.score > '70'
)
) AS first,
( SELECT score FROM scores
WHERE (
students.name = scores.name
AND
scores.exam = 'second'
AND
scores.score > '80'
)
) AS second,
( SELECT score FROM scores
WHERE (
students.name = scores.name
AND
scores.exam = 'third'
AND
scores.score > '90'
)
) AS third
FROM students
) AS c
where c.first is not null or c.second is not null or
c.third is not null;