473,395 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How To write An Sql Crosstable Select statment

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 ***
Jul 23 '05 #1
1 4660
Joe Saliba (jo*******@hotmail.com) writes:
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, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: ChrisC | last post by:
how would I put a '\n' in say outfile.write( record, sizeof(record)). Thank you in advance for your help. -- ChrisC - chrispche@nospam.yahoo.co.uk
1
by: e_AK_05 | last post by:
I have a question and I can't figure out how to do it. I have a select statment : SELECT table1.* AS table1.*, table2.* AS table2.* FROM table1, table2 WHERE 1 this does not work...for me at...
6
by: RCS | last post by:
I've been running into more and more complexity with an application, because as time goes on - we need more and more high-level, rolled-up information. And so I've created views, and views that use...
1
by: Joe Saliba | last post by:
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...
5
by: orencs | last post by:
Hello, I am using Microsoft.Practices.EnterpriseLibrary.Data. I am running the following sqlCommand = "SELECT var1 FROM table1 WHERE var2 IN (4,5,6) ; SELECT var3 FROM table2 WHERE var2 IN...
6
by: mabond | last post by:
Hi Is it possible to compare a vaule for a select case statement using a wildcard. e.g. somthing like Select case myValue case like "*ing" end select
1
by: zeebiggie | last post by:
Good morning I have a form with the controls in the insert statment below. table1 has an Auto increment primary key hence is omitted in the insert statment and form. Am getting the error It didnt...
2
by: gimme_this_gimme_that | last post by:
I use the following SQL statment to bring z_emp_id values to a employee table: update employee set z_emp_id = (select z.emp_id from z.employee z where z.login=employee.login) Upon executing...
8
by: Trevor2007 | last post by:
I am trying to hard code the following select query into a select case statement ie (case1 <statment>, case 2 <statment>) but I getteing Compiler error: expected line number or label, or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.