I want to sum 3 different values after i use the count. This is the query i'v got to get 3 different values.
SELECT f.filmid, filmtitel, count(award_type)
FROM film F
INNER JOIN film_award_uitreiking FAU ON F.filmid = FAU.filmid
INNER JOIN Film_award FA ON FA.awardid = FAU.awardid
WHERE fau.filmid = 4317
GROUP BY FA.award_type
ORDER BY count(fau.awardid) DESC;
Now i want to sum them together any suggestions ?
CodePudding user response:
select sum(atcount) from
(
SELECT f.filmid, filmtitel, count(award_type) as atcount
FROM film F
INNER JOIN film_award_uitreiking FAU ON F.filmid = FAU.filmid
INNER JOIN Film_award FA ON FA.awardid = FAU.awardid
WHERE fau.filmid = 4317
GROUP BY FA.award_type
) x