Guys! I have this query that I want to use in Django and I can not find a way to do it. I hope you can help me:
SELECT herramienta_id, SUM(cantidad) FROM inventario_transaccion
WHERE carrito_id=1
GROUP BY herramienta_id
What I want to do is get a list of unique tools and do the sum of the amount. Example
herramienta cantidad
+-----------+----------+
| martillo | 2 |
| clavos | 1 |
| martillo | 1 |
+-----------+----------+
I get as a result
herramienta cantidad
+-----------+----------+
| martillo | 3 |
| clavos | 1 |
+-----------+----------+