Why does my query involving division and COUNT always result in 1?
问题 I've simplified this down a bit since the literal data is pretty massive but a very simple example will suffice. I'm working on a query where because of the massive amount of data, I'm looking to do some aggregation in one shot instead of many many steps. I have two tables <<customers>> id | first_name | last_name 1 | Reed | Richards 2 | Johnny | Storm 3 | Peter | Parker <<purchases>> id | cid | date 1 | 1 | 2017-01-09 2 | 2 | 2017-01-09 3 | 2 | 2017-01-09 4 | 3 | 2017-01-09 When I run the