SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 To join the data in the column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Black_Trouble
Starting Member

Turkey
21 Posts

Posted - 10/01/2012 :  07:04:05  Show Profile  Reply with Quote
Hi friend,

I want to merge the data in the table below. But in a kind of way I wanted to I could not. Table to as



the result,

2503|2012-09-28|A352|WORLD MECIDINE|A-212023|A-161422,A-161478,A-161537,A-161594,A-161653|18,00|738,72|59,10|797,82





Mike Jackson
Starting Member

37 Posts

Posted - 10/01/2012 :  08:33:27  Show Profile  Reply with Quote
you want to merge if from where? to where?

Mike
Go to Top of Page

Black_Trouble
Starting Member

Turkey
21 Posts

Posted - 10/01/2012 :  09:42:45  Show Profile  Reply with Quote
I'm sorry I forgot to write code. as a group to be merged. IRSFISEVRAKNO1 part of the comma (,) separated by.


SELECT [IRSFISFATREFNO],IRSFISFATTAR,IRSFISCARKOD,IRSFISCARUNVAN,IRSFISFATURANO,IRSFISEVRAKNO1
,IRSFISKDVORANI,IRSFISMALTOP,IRSFISKDVTUTARI,IRSFISGENTOPLAM     
 FROM IRSFIS


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/01/2012 :  12:08:41  Show Profile  Reply with Quote
something like


SELECT *,
STUFF((SELECT ',' + IRSFISEVRAKNO1 FROM IRSFIS
WHERE [IRSFISFATREFNO] =t.IRSFISFATREFNO
AND IRSFISFATTAR = t.IRSFISFATTAR 
AND IRSFISCARKOD = t.IRSFISCARKOD 
AND IRSFISCARUNVAN = t.IRSFISCARUNVAN 
AND IRSFISFATURANO = t.IRSFISFATURANO 
FOR XML PATH('')),1,1,'') AS ValueList
FROM
(
SELECT  DISTINCT [IRSFISFATREFNO],IRSFISFATTAR,IRSFISCARKOD,IRSFISCARUNVAN,IRSFISFATURANO
,IRSFISKDVORANI,IRSFISMALTOP,IRSFISKDVTUTARI,IRSFISGENTOPLAM     
 FROM IRSFIS
)t


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Black_Trouble
Starting Member

Turkey
21 Posts

Posted - 10/02/2012 :  05:28:51  Show Profile  Reply with Quote
Thank you very much. With a few tweaks came in the shape you want. :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/02/2012 :  10:29:38  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000