Reputation:
I'm using phpMyAdmin and I've this SQL table:
___SalesTaxes
|--------|----------|------------|
| STX_Id | STX_Name | STX_Amount |
|--------|----------|------------|
| 1 | Tax 1 | 5.00 |
| 2 | Tax 2 | 13.50 |
|--------|----------|------------|
How can I sum the total of the taxes if I know the STX_Id
to sum.
For example, I need to sum the 1
and 2
to give 18.50
.
What I tried:
SELECT SUM(STX_Amount)
FROM ___SalesTaxes
WHERE FIND_IN_SET(STX_Id, '1,2') > 0
AS sum_taxes;
Thanks.
Upvotes: 1
Views: 40
Reputation: 326
Remove 'AS sum_taxes' from the end of your query.
SELECT SUM(STX_Amount)
FROM ___SalesTaxes
WHERE FIND_IN_SET(STX_Id, '1,2') > 0
Upvotes: 0