Answer the question
In order to leave comments, you need to log in
Why does SQL summarize with the previous group?
Here are the databases that are being sampled:
The database of ships that participated in the Second World War is considered. The relationships are:
Classes (class, type, country, numGuns, bore, displacement)
Ships (name, class, launched)
Battles (name, date)
Outcomes (ship, battle, result)
SELECT country, SUM((POW(bore, 3) / 2)) FROM Classes GROUP BY country;
And here is the result:country mw
germany 1687.5
gt.britain 3375
japan 4288
usa 5468
Answer the question
In order to leave comments, you need to log in
The request does exactly what you asked - counted with grouping by country. If you want to group more by type, then add it to the grouping list:
SELECT country, type, SUM((POW(bore, 3) / 2)) FROM Classes GROUP BY country, type;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question