SELECT
id,
SUM(amount*price) AS total
FROM mytable
GROUP BY id
डेटा:
| id | amount | price |
|----|--------|-------|
| 2 | 3 | 19 |
| 2 | 3 | 89 |
| 3 | 203 | 1 |
परिणाम:
id total
2 324
3 203
SELECT
id,
SUM(amount*price) AS total
FROM mytable
GROUP BY id
डेटा:
| id | amount | price |
|----|--------|-------|
| 2 | 3 | 19 |
| 2 | 3 | 89 |
| 3 | 203 | 1 |
परिणाम:
id total
2 324
3 203