Is it possible to get the total without returning it in multiple rows (Group BY)?
Example:
Data:
ID Amount Quantity
1 50 1
2 50 2
select sum(Amount) * Quantity, SUM(Quantity) as totalQuantity
from tbl
I want the results to be in 1 row:
total totalQuantity
150 3
Here you go
SELECT SUM(Amount*Quantity) as total, SUM(Quantity) as totalQuantity
select sum(Amount * Quantity) as total,
sum(Quantity) as totalQuantity
from your_table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With