Indicate Sql query where you get the following columns total purchases, grouped by customer and totalized for the following Tables: Data:
Tabla CLIENTE
CAMPO TIPO
---------------------------
DNI Char(10)
Nombre Varchar(30)
Apellido Varchar(30)
Tabla Pedidos
CAMPO TIPO
---------------------------
npedido Numérico(4)
fecha Datetime
cantidad Numeric(8)
monto Money
Cliente_dni Char(10)
Directions: Use the commands sum, count, group by, order by, compute, join
I am using the following:
select nombre, sum(cantidad), sum(monto)
from cliente, pedidos
group by nombre
The expected result would be if pedro jimenes buys 10 items of cost 10 each:
CustomerName - amount - amount
pedro jimenes 10 100
The result in the amount and amount column is the same for all customers.
How do I separate the products by customer?