select kraj, imie from zawodnicy select imie + ',' from zawodnicy where kraj = 'pol' for xml path('') select distinct kraj, (select imie + ',' from zawodnicy where kraj = z.kraj for xml path('')) imiona from zawodnicy z select part, (select dane from testowa where dane like '%'+part+'%') from (select * from dbo.SDF_SplitString((SELECT dane + ',' FROM testowa FOR XML PATH ('')),',')) t select * from dbo.SDF_SplitString('a,b,c',',') select part, (select dane from testowa where dane like '%'+part+'%') from (select * from dbo.SDF_SplitString( (select dane+',' from testowa for xml path('')),',')) t select imie, nazwisko, wzrost from zawodnicy order by wzrost desc offset 3 rows fetch next 4 rows only