Suppose I have a table that contains a number of transactions but I'd like to weight them by the number of stores in that state, is there a SQL command I can use that calculates the weighted average and not just the average (AVG())?
|STATE | NUMBER OF STORES | NUMBER OF TRANSACTIONS |
|-------|------------------|--------------------------|
| ca | 25 | 500 |
|-------|------------------|--------------------------|
| il | 2 | 25 |
|-------|------------------|--------------------------|