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
 QUERY HELP FOR COMMA SEP
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pnpsql
Posting Yak Master

India
241 Posts

Posted - 06/29/2012 :  06:21:59  Show Profile  Reply with Quote

I HAVE TWO TABLES LIKE

TBL_ID

ID (PK) RATE
1 10
2 15
3 20
4 25
5 30

TBL_DETAIL

ID RATE DATE
1 10 '02-JAN-2012'
1 10 '02-FEB-2012'
1 10 '02-MAR-2012'
1 10 '05-MAR-2012'
1 10 '08-APR-2012'
1 10 '10-MAY-2012'
2 15 '02-JULY-2012'
2 15 '05-JULY-2012'
2 15 '08-AUG-2012'



NOW I NEED TO SHOW RECORDS LIKE

TBL_ID.ID , TBL_ID.RATE , TBL_DETAIL.DATE
1 10 '02-JAN-2012' , '02-FEB-2012', '02-MAR-2012' , '05-MAR-2012' , '08-APR-2012' , '10-MAY-2012'
2 15 '02-JULY-2012' , '05-JULY-2012' , '08-AUG-2012'



PLEASE SUGGETS


challenge everything

nigelrivett
Flowing Fount of Yak Knowledge

United Kingdom
3328 Posts

Posted - 06/29/2012 :  07:17:48  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
see
http://www.nigelrivett.net/SQLTsql/CSVStringSQL.html


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sshelper
Posting Yak Master

213 Posts

Posted - 06/30/2012 :  03:22:14  Show Profile  Visit sshelper's Homepage  Reply with Quote
Here's a similar link: http://www.sql-server-helper.com/tips/comma-delimited-output.aspx

SQL Server Helper
http://www.sql-server-helper.com/tips/tip-of-the-day.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47189 Posts

Posted - 07/01/2012 :  01:03:18  Show Profile  Reply with Quote
though unrelated to original problem,one question remains. why are you storing date values as varchar in table?

------------------------------------------------------------------------------------------------------
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