Need help in creating a query
What you are needing help is called Grouped Concatenation in SQL Server

This sql fiddle that I created will help you. 

Basically you use stuff + FOR XML PATH.

If you are on sql server 2017 (vNEXT) then STRING_AGG is an inbuilt function that you can use

-- sql server vNEXT 

SELECT [ColumnA]  =  [ColumnA],
       [ColumnBs] = STRING_AGG(ColumnB, ',')
 from dbo.Table1   
 group by ColumnA