Hello everyone,

How can I prevent group by clause from reducing the number of rows without
affecting accuracy of what aggregate functions provide?

Scenario:
My club has-many coaches.
Each coach trains a team of players.
Of course, a player has-many matches and a match has-many players.
Given the schema: https://pastebin.com/raw/C77mXsHJ
and sample data: https://pastebin.com/raw/GhsYktRS

I want a result like: https://pastebin.com/raw/stikDvYS

NOTE: for a match X, profit/match is `sum(salary of all players playing in
X) - X.bets`

To get the result, here's what I came up with: https://pastebin.com/ckgicBWS

If I un-comment those lines, I get the profit column but rows are reduced,
how can I prevent that?

Thanks,
Rocky.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to