Kod Kütüphanem ama elime ne gelirse burada dursun diye…

STUFF ile istenilen alana ait değerleri “,” ile bir araya getirme

SELECT 
T2.FieldSomething,
        STUFF(( SELECT ',' T1.Field
                 FROM Table1 T1
                 WHERE T1.IDField =T2.IDField
                 ORDER BY T1.Field
        FOR
        XML PATH('')
        ), 1, 1, '') AS FieldName
FROM Table2 T2

 

Related articles

Group by Day – Örnekleri ile

Grouping By Day Of month: In order to group the data by day you can use sql server in built DAY() funtion. Grouping By Day Of week: For this you can use DATEPART(weekday,[date column]) Grouping By week: For this you can use DATEPART(week,[date column]) Grouping By DAY of Year: For this you can use DATEPART(dayofyear,[date […]

Learn More

SELECT yapısı içinde Önceki ve Sonraki Kayıt

SELECT LAG(p.FirstName) OVER (ORDER BY p.BusinessEntityID) PreviousValue, p.FirstName, LEAD(p.FirstName) OVER (ORDER BY p.BusinessEntityID) NextValue FROM Person.Person p       Kaynak: sqlauthority.com

Learn More

SQL ve XML

DECLARE @XML XML='<IDLIST><ID VALUE=”00000000-0000-0000-0000-000000000000″/></IDLIST>’ DECLARE @docHandle INT CREATE TABLE #tmp ( ID UNIQUEIDENTIFIER  ) EXEC sp_xml_preparedocument @docHandle OUTPUT, @XML INSERT INTO #tmp SELECT  * FROM OPENXML (@docHandle, ‘/IDLIST/ID’, 1) WITH(VALUE UNIQUEIDENTIFIER) EXEC sp_xml_removedocument @docHandle  

Learn More

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir