Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2005, 02:48 AM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to suraj Send a message via Yahoo to suraj
Default simple query for displaying groups...

Hi all,
I'm a beginner in sqlserver2000.
I have a small question.
I have a small table as follows:
company products
------- --------
123 pencil
123 ink
123 fillers
123 cartridge
124 apple
124 orange

The objective is to display company and its products separated by commas.
123 pencil,ink,fillers,cartridge
124 apple,orange

I did it by creating a cursor by storing those two values in two temp variables and going row by row appending the characters. Since cursors are said to be slow, can this be done by select statements? I don't want to create another table for the same data this table has.
thank you for any ideas.
suraj

 
Old September 2nd, 2005, 06:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

I answered this a couple years ago (wow, has it been that long?). Take a look at:

http://p2p.wrox.com/topic.asp?TOPIC_ID=1787

and see if that helps you...

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Query Need Help ~Bean~ SQL Language 2 June 27th, 2005 11:22 AM
Simple Tomcat Query? Baztec Apache Tomcat 0 January 13th, 2004 11:38 PM
Simple Query/Display ABATES VS.NET 2002/2003 1 August 10th, 2003 05:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.