gsSQL
gsSQL copied to clipboard
Calculation using two AGGREGATE functions FAILS.
The SUM() aggregate fields will return the correct values if used as the single source of info for the select field, but it fails when a calculation is done using the results of two or more aggregate functions. In this case it returns ONLY the sum of QUANTITY - and does not subtract the sum of PRICE.
let stmt = "select sum(quantity) - sum(price) from booksales";