Seppe, your solution really is elaborate, but correct :)
But I said 'without _linked_ subquery', which means you still use a
normal subquery :)
(linked subquery is when you use tables from your outer query in your
subquery, which for this question just makes it easier on the mind to
solve it. With linked subquery the result would be:
SELECT Bo.title , Bo.price, Bo.price - (
SELECT avg(sub.price)
FROM Books sub
WHERE Bo.language = sub.language
) AS Difference
FROM Books Bo;
but this solution is _slow_.
On the otherhand: Thomas is deadon.
Anyway, if you people can solve it, so can my students (for their exam
;))
Kenny
Thomas' answer would have been my first choise as well, but the linked
subquery confused me (so I just avoided all subqueries). I suppose if
they know the defenition of linked subqueries (unlike me) this is even
a fairly easy question.