I am on MS SQL Server.
I have a few records like this:
id | firstname | startpoint | endpoint | lastname
---------------------------------------------------------------------
1 | james | A | B | bond
2 | james | B | C | bond
3 | james | X | Z | bond
the only difference between these records are startpoint and endpoint
I would like to see something like this:
firstname | startAndEndPoint | lastname
-------------------------------------------------
james | A, B, C, X, Z | bond
I've tried select concat(startpoint, ', ', endpoint) as startAndEndPoint from table where lastname = 'bond'
but it still gives me the result like this:
firstname | startAndEndPoint | lastname
james | A, B | bond
james | B, C | bond
james | X, Z | bond
I believe array_agg() function can help me according to this post but it appears that function is available in postgres, not sql server.