I have transaction table proposal_header
and the detail table is proposal_item
, what I need is to get concatenated tender_number
grouped by detail_number
in proposal_item
, but I don't get it how to concatenate it, how the query should be?
the proposal_header table is :
id tender_number
7 BS7
12 BS12
14 CS14
the proposal_item table is:
proposal_header_id detail_number
7 161932
7 161929
12 161932
12 161929
14 334659
and then i have joined:
select b.id as mainId,a.detail_number ,b.tender_number
from dbo.proposal_header b
inner join dbo.proposal_item a on a.proposal_header_id =b.id
the result of join is:
main Id detail_number tender_number
7 161932 BS7
7 161929 BS7
12 161932 BS12
12 161929 BS12
14 334659 CS14
but what i need, is only detail number and concate tender number, is there a solution to make it like this ?
detail_number tender_number
161932 BS7, BS12
161929 BS7, BS12
334659 CS14