Nice schema.  Do you have a valid one?

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Rocky Ji
>Sent: Sunday, 17 February, 2019 09:47
>To: SQLite mailing list
>Subject: [sqlite] How to get aggregate without reducing number of
>rows (repeats are ok)?
>
>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



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

Reply via email to