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 September 17th, 2004, 03:45 AM
Registered User
Join Date: Nov 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Berni016x
Default Crosstab query

How to write a crosstab query?
i got one at access2000 but this doesn't work at sql server 2000

can anybody help me please?

it is like the following.
a table named SUBSCRIBERS
a table named INTERESTS

The query does the following:
1 0 1 1
2 1 0 0
3 1 1 1

explanation: the subscriber with the id = 1 has got the interest with the id=2 and the interest with the id=3

each datarows of the INTERESTS-Table is a column at the query.

please help!


Old September 17th, 2004, 09:26 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post

This article shows the basic ways of generating a crosstab in SQL Server. http://support.microsoft.com/default.aspx?kbid=175574#3
Old September 17th, 2004, 10:43 AM
Registered User
Join Date: Nov 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Berni016x

Thank you for reply!
Sorry, this article can't help me, because the columns are dynamic!
so each column is a entry at the of the other table.

this is a resolution of a m:n relationship!

this is the reasion, why i wrote [...] at the example.


Similar Threads
Thread Thread Starter Forum Replies Last Post
crosstab query and parameter stoneman Access 10 January 6th, 2006 04:45 PM
crosstab query and asp tulincim Classic ASP Databases 0 September 13th, 2005 03:00 PM
Crosstab query with no results edubbelaar Access 0 November 22nd, 2004 06:12 AM
Crosstab Query Ben Access 7 November 22nd, 2004 06:08 AM
Crosstab query vladimir Access 1 December 1st, 2003 04:02 PM

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