Query Sql with problems

0

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.

    
asked by Luis Gabriel Fabres 29.05.2018 в 00:22
source

1 answer

1

Hello the error that is marking you is that you are missing Add ProductName in the Group by of your SQL query, you must indicate all the fields. group by A.AuxstockArrProductoId, B.ProductName, total Greetings!

    
answered by 29.05.2018 / 00:43
source