For the first ID which is 1265 I want only one record like this(look below), and for now I have three different records for the same ID and that isn't good. You can see that in the first record with ID = 1265 I would like to have concated strings into one separated with ',':
1265 MARK, LISA, MAY
Here is my code sample:
select
vup.UgovorId as ID,
concat(p.Naziv, p.Naziv) as NUMBER
from
[TEST_Ugovori_Prod].dbo.VezaUgovorPartner as vup
inner join
[TEST_MaticniPodaci2].[dbo].[Partner] as p on vup.PartnerId = p.PartnerID
group by
vup.UgovorId, p.Naziv
order by
vup.UgovorId desc
Here are my results:
1265 MARK
1265 LISA
1265 MAY
1264 LINDA
1263 MARTINA
1262 MARKO
1261 VIDAKS
1260 PEEKS
1259 MARCUS
1258 MARKO
1257 MATIA
1256 POPOVIC