I need to fetch the data from SQL Server based on the below condition.
In the database there are columns Ticketnumber and comments. For a Ticketnumber there are multiple records, for the same ticket number there are multiple comments stored in different records. Whenever I retrieve the ticketnumber and comments columns, the comments should be concatenated in the single record.
Let's look at an example:
Ticketnumber Comments
-------------------------------
1002 Case raised
1003 Case raised
1002 Processing,
1003 resolved
1002 resolved
Expected output should be:
Ticketnumber Comments
-----------------------------------------------
1002 Case raise,processing,resolved,
1003 case raised,resolved
All the comments should be concatenated for single ticketnumber as above.
Please provide the query. Thanks in advance