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)
 UNSOLVABLE....

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-11-10 : 08:17:21
Naveen writes "hi,
I have THREE tables namely SERVICES s , TRANSACTIONS t and RESERVATIONS r
I want to display t.transactid,r.name, r.roomid,s.serdescrptn, s.servicecharge and the sum of servicecharges as one result set

TWO CONDITIONS:
1.All fields are must
2.Cant use COMPUTE since it is givinG the answers in two result sets

MS has been nice enough to add the CUBE AND ROLLUP operators so I can have totals with my results.

But out of shear meanness they won't let me use them unless I use a Group By clause in my select. I have a select with 5 fields, and only want to Group By one field namely servicecharge and display the sum of the field under it at the end of the last table....

HEY GURU can u solve it?

ISthere anyother options than using CUBE/ROLLUP?

Thanks,
NEO"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-11-10 : 08:18:45
I agree that this is unsolvable, only because YOU DIDN'T PROVIDE ENOUGH DETAIL. How about posting your DDL (CREATE TABLE) statements and some hint as to how these tables relate to each other? Some sample data and desired output is also recommended.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-10 : 08:39:04
At least you didn't suggest TRUNCATE TABLE master..systables this time...


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-10 : 08:43:36
Also, another user posted exactly the same question here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=74624


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-11-10 : 09:38:38
To answer your question: Yes, I can solve it.






CODO ERGO SUM
Go to Top of Page
   

- Advertisement -