This script uses data available at hand to show the idea.
select res = case det.rn
when 0 then '[titles],'
+ t1.title_id +','
+ t1.title +','
+ cast(t1.[pubdate] as varchar(50))
else det.itm
end
from [titles] t1
cross apply (
select rn = 0, itm = null
union
select rn = 1
,itm = '[titleauthor],'
+ t1.title_id +','
+ cast([au_ord] as varchar(50))+','
+ cast([royaltyper] as varchar(50))
from [titleauthor] t2
where t2.title_id = t1.title_id ) det
order by t1.title_id, det.rn
Output
[titles],BU1032,The Busy Executive's Database Guide,Jun 12 1991 12:00AM
[titleauthor],BU1032,1,60
[titleauthor],BU1032,2,40
[titles],BU1111,Cooking with Computers: Surreptitious Balance Sheets,Jun 9 1991 12:00AM
[titleauthor],BU1111,1,60
[titleauthor],BU1111,2,40
[titles],BU2075,You Can Combat Computer Stress!,Jun 30 1991 12:00AM
[titleauthor],BU2075,1,100
[titles],BU7832,Straight Talk About Computers,Jun 22 1991 12:00AM
[titleauthor],BU7832,1,100
[titles],MC2222,Silicon Valley Gastronomic Treats,Jun 9 1991 12:00AM
[titleauthor],MC2222,1,100
[titles],MC3021,The Gourmet Microwave,Jun 18 1991 12:00AM
[titleauthor],MC3021,1,75
[titleauthor],MC3021,2,25
Adapt it for your tables.