--producto, total del producto emitido --(Precio*Cantidad). Muestre los subtotales --por Pedido, ao y cliente Select C.NomCliente, Year(PC.FechaPedido) AO, PC.IdPedido,p.NomProducto, SUM(pd.Cantidad*pd.PrecioUnidad) TOTAL from Ventas.pedidoscabe PC JOIN Ventas.clientes C on pc.IdCliente=c.IdCliente JOIN Ventas.pedidosdeta PD on pd.IdPedido=pc.IdPedido JOIN Compras.productos P on p.IdProducto=pd.IdProducto group by C.NomCliente, Year(PC.FechaPedido), PC.IdPedido,p.NomProducto with RollUP