MySQL GROUP BY doesn't work when migrated to SQL Server 2012

前端 未结 3 1705
执笔经年
执笔经年 2021-01-23 06:08

I\'m moving my Delphi application from MySQL to SQL server 2012. In MySQL I had this query:

SELECT *,(XS+S+M+L+XL+XXL+[1Size]+Custom) as Total FROM StockData  
G         


        
3条回答
  •  独厮守ぢ
    2021-01-23 06:52

    All columns in an aggregate query must either be used by an aggregate function or a group by. Try only selecting the columns you require rather than * I.e. select stylenr, customer, color, ([...] ) as Total from.

    This is a SQL standard way of dealing with aggregates, you'd get a similar error in Oracle.

提交回复
热议问题