Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
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 February 7th, 2005, 09:26 AM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rows to columns by joining to tables

I have two tables

FIRST TABLE

CompID,Name
-----------
1 ,A
2 ,B


SECOND TABLE

CompID,Value
-------------
1 ,P
1 ,Q
2 ,R
2 ,S
2 ,T


I want a SQL query to get the resultset like the following

CompID,Value1,Value2,Value3
1 ,P ,Q ,null
2 ,R ,S ,T

Any help will be highly appreciated
Subhasis Chandra






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help joining tables and restricting records bren582 SQL Server 2005 3 January 18th, 2008 02:45 PM
joining tables pit_bait SQL Language 2 September 28th, 2007 07:29 AM
Joining Three Tables Alexpizzoferro Classic ASP Databases 5 September 1st, 2006 04:08 PM
joining 3 tables koskalgr MySQL 5 March 24th, 2006 09:52 AM
Joining two tables rajustha SQL Server 2000 1 December 7th, 2003 07:38 AM





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