SQL - transaction with > 1 line - merge to one row

Have huge data with more have > 1 row for 1 transaction.

I need to merge the rows to just one, or just use a column in the row and add as a separate column.

Need help!

Please illustrate by providing:

  • table definition(s) in the form of create statement(s)
  • sample data in the form of insert statements
  • the query you have so far (if no query, then at least a description of how the tables should be joined)
  • expected output from the sample data you provide
  • more detailed description of what exactly you are trying to accomplish

hi

for the sake of demo purpose

creating test data

Creating dummy data to test concept Have huge data with more have > 1 row for 1 transaction.
use  tempdb 
go 


drop table #data 
go 


create table #data 
(
transaction   int ,
name  varchar(100) ,
age  int 
)
go 


insert into #data select 1,'har',40 
insert into #data select 1,'pra',34
insert into #data select 1,'ok',23
insert into #data select 1,'not bad',12
insert into #data select 2,'eat something',46 
insert into #data select 2,'dog',39
insert into #data select 2,'shup',90
go

could you please give us clear picture on how you want to merge in one row

diagram

or

example