# Question : Can i group by a concat column in SQL?

## Answer : Can i group by a concat column in SQL?

##### ```1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: ``` ```SELECT [Item No_] AS SDAITM, MAX([Description]) AS 'IMDSC1', CAST(SUM([Invoiced Quantity] * -1) AS INTEGER) AS 'SDQTYT', INVDATE, CONVERT(char(10), GETDATE(), 103) AS 'DATE', CONVERT(char(8), GETDATE(), 8) AS 'TIME' FROM ( SELECT dbo.[company\$Item Ledger Entry].[Document No_], dbo.[company\$Item Ledger Entry].[Item No_], dbo.[company\$Item].[Description], dbo.[company\$Item Ledger Entry].[Invoiced Quantity], CONVERT(char(4), YEAR(dbo.[company\$Item Ledger Entry].[Last Invoice Date])) + CONVERT(char(2), RIGHT(REPLICATE('0',2)+ LTRIM(MONTH(dbo.[company\$Item Ledger Entry].[Last Invoice Date])),2)) AS INVDATE FROM dbo.[company\$Item Ledger Entry] INNER JOIN dbo.[company\$Item] ON dbo.[company\$Item Ledger Entry].[Item No_] = dbo.[company\$Item].No_ INNER JOIN dbo.[company\$Default Dimension] ON dbo.[company\$Item Ledger Entry].[Item No_] = dbo.[company\$Default Dimension].No_ INNER JOIN dbo.[company\$Item Category] ON dbo.[company\$Item Ledger Entry].[Item Category Code] = dbo.[company\$Item Category].Code WHERE dbo.[company\$Item Ledger Entry].[Item No_] NOT IN ('10000','10002','40000') AND dbo.[company\$Item Ledger Entry].[Location Code] NOT IN ('WS', 'WF', 'WS-GU', 'WS-LG', 'GO', 'FR', 'BOO1') AND dbo.[company\$Item Ledger Entry].[Entry Type] = 1 AND dbo.[company\$Item Ledger Entry].[Document No_] != 'TAKE-ON' AND dbo.[company\$Default Dimension].[Dimension Value Code] = 'brand' AND dbo.[company\$Item Category].[Description] = 'product' ) SQ GROUP BY [Document No_], [Item No_], INVDATE ORDER BY INVDATE ```
 Random Solutions