sql - Group by error ssms, should be quick fix but can't find it -
below query. i'm getting error in group by
statement, , cannot figure out why. included error well.
select a.[order date] ,a.[customer #] ,a.[order #] ,a.[order type] ,ordertotal ,case when c.offertype in ('catalog') 'y' else 'n' end 'catalog match' ,b.channelgroup lwpim.dbo.marketingreporting left join ( select sum([total price]) ordertotal lwpim.dbo.marketingreporting [order date] between '2016-01-01' , '2016-06-30' group [order date] ,[total price] ) d left join user_sandbox.dbo.offercodeoffertype c on a.[offer number] = c.offercode , a.[matchback offer number] = c.offercode left join user_sandbox.dbo.gadata2016 b on a.[order #] = b.order_number group a.[customer #] ,a.[order #] ,a.[order date] ,a.[order type] ,ordertotal ,case when c.offertype in ('catalog') 'y' else 'n' end ,b.channelgroup order a.[order date] desc ,ordertotal desc
msg 156, level 15, state 1, line 16 incorrect syntax near keyword 'group'.
Comments
Post a Comment