Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 May 4th, 2004, 03:21 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default Query Direction??

I looking to write a query in TSQL that instead of listing my results as follows;;
Number Company Contact
00001-005 ABC Inc. Jones, Joey
00001-005 ABC Inc. Doe, John
00001-005 ABC Inc. Rubble, Barney

instead would list the results like this if the "Number" is the same.
Number Company Contact1 Contact2 Contact3
00001-005 ABC Inc. Jones, Joey Doe, John Rubble, Barney

Is it a cross tab query or do i make use of cursors, or derived tables. Just looking for direction. will do the leg work once i get the right path. Thanks, bph


 
Old May 5th, 2004, 05:58 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

do you have an identity column for each row?
 
Old May 11th, 2004, 08:01 AM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by jemacc
 do you have an identity column for each row?

No. Don't need it.


 
Old May 11th, 2004, 08:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

You can use the "GROUP BY" Sql statement. Check Books online.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old May 11th, 2004, 08:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Wait- on second thought.. no.. that won't work. You would need to create a DISTINCT query that would get a list of the "number" column and then do a join to that of the data. The problem is, I assume, there can be any number of rows that need to be joined. Rather than always being three. The best way to do this is probably in a business object. That's how I would do it.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old May 11th, 2004, 08:46 AM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Hal Levy
 Wait- on second thought.. no.. that won't work. You would need to create a DISTINCT query that would get a list of the "number" column and then do a join to that of the data. The problem is, I assume, there can be any number of rows that need to be joined. Rather than always being three. The best way to do this is probably in a business object. That's how I would do it.


Hal Levy
Web Developer, PDI Inc.
NOT a Wiley/Wrox Employee
Thanks Hal. BO is currently beyond my set of skills. I'm going to take a look at SQL Smarties by Joe C.

 
Old May 11th, 2004, 09:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Do you write VB? C++ or any .net language?


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old May 11th, 2004, 09:45 AM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Hal Levy
 Do you write VB? C++ or any .net language?


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
vb.net






Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Direction!!! daivan Intro Programming 2 May 3rd, 2006 12:09 PM
point in the right direction, please chriswinn ASP.NET 1.0 and 1.1 Basics 2 February 10th, 2005 07:40 AM
Looking for design direction on database Phill VB Databases Basics 1 June 29th, 2004 02:26 AM
Which direction to go? Jedidia HTML Code Clinic 3 December 2nd, 2003 03:12 PM
Need help or direction Ankleburner Forum and Wrox.com Feedback 1 October 30th, 2003 02:52 PM





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