Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Best way to generate a report?

Author  Topic 

ly
Starting Member

6 Posts

Posted - 2003-09-19 : 07:33:52
Hi everyone please help with this problem:

The client database (MS SQL server) contains the following tables:
tblBudget, tblTarget, tblActual. The size of the the tables are very large. The fields of the three tables are all in the same way as below and each table contain different data:

Country Port Type Unit
A A 20’ 4
A B 20’ 4
B A 20’ 2
B B 40’ 22
A A 40' 5

What's the best way to produce a report as below? The data are the subtotals and totals.

buget target actual
20' 40' 20' 40' 20' 40'
country A
port A 4 55 10 15 null 5
port B null 9 null 8 11 6
total 4 64 10 23 11 11

Country B
port A 5 60 11 25 null 8
port B 8 9 null null 12 6
total 13 69 11 25 12 14

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-09-19 : 08:01:54
please give us some create table statements and some sample data.

i.e.,

CREATE TABLE Ports (Country char(1), .... etc..)

INSERT INTO TABLE Ports
SELECT 'a','b',c' UNION
SELECT 'b','c',d' ..etc ...

YOu have not given us any infomation on what Budget means, how target is calculated, and what actual is. what are these numbers?

Just a little more info and we'll all be glad to help you out ! Remember, we have no knowledge whatsoever of your problem or needs except for what you put in your posts.

Please check this out, and look at the thread it references for examples of providing sample data and expected results:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=29090

- Jeff
Go to Top of Page
   

- Advertisement -