I have the following query
select A.AuxstockArrProductoId, B.ProductoNombre, (A.AuxstockArrSubctaCant)as total
from AuxSctaStockArr A
inner join Producto B on A.AuxstockArrProductoId = B.ProductoId
group by A.AuxstockArrProductoId
having sum(A.AuxstockArrSubctaCant) > 0
order by A.AuxstockArrProductoId
I need to add the name of the product to the side of the copdigo, but I get an error in the query that says:
Mens. 8120, Level 16, State 1, Line 1 Column 'Product.ProductName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Someone who can tell me how to add the name of the product in this query please.