dbTalk Databases Forums  

How To write An Sql Crosstable Select statment

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss How To write An Sql Crosstable Select statment in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joe Saliba
 
Posts: n/a

Default How To write An Sql Crosstable Select statment - 05-08-2005 , 08:09 AM






Hi,

would like to know how to write a crosstable select statment in sql
server2000 where having:
- ItemNumber, ItemDescription, ItemColor, ItemSize as rows
- Stores as columns
- Qty * Netttc as value

from Table sales

thx

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: How To write An Sql Crosstable Select statment - 05-08-2005 , 09:34 AM






Joe Saliba (josephs73 (AT) hotmail (DOT) com) writes:
Quote:
would like to know how to write a crosstable select statment in sql
server2000 where having:
- ItemNumber, ItemDescription, ItemColor, ItemSize as rows
- Stores as columns
- Qty * Netttc as value

from Table sales
The problem here is that the result of SELECT statement is a table, and
in a relational DBMS, a table should have a fixed set of a columns.
Assuming that the number of stores than can change over time, the above
request - reasonable as it may be - does really fit in well. To achieve
the result, you will need to endulge in a lot of dynamic SQL. You may find
that it's easier to this client-side.

Nevertheless, a standard recommendation to this in SQL, is to look at
RAC, a third-party tool. I have never used it myself, though. Check out
http://www.rac4sql.net/


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.