The documentation for the SQL SUM function lists its "signature" like this:
SUM([DISTINCT] expr)
The only examples listed for expr are single column names (like units, price, etc.), but can one do more with it? expr sounds very broad and open...
I'm especially interested in if it's possible to do any sort of selection of what exactly to sum. For example, I'd really like to do the following right now:
SELECT
SUM(hours) 'Hours total',
SUM(hours WHERE date BETWEEN '2017-10-01' AND '2017-10-31') 'Hours last month'
But that doesn't run... Probably too much of an expr dream, but maybe...? Maybe not?
Is anything like that possible with the SUM function? What can expr be?