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.
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 rI want to display t.transactid,r.name, r.roomid,s.serdescrptn, s.servicecharge and the sum of servicecharges as one result setTWO CONDITIONS:1.All fields are must2.Cant use COMPUTE since it is givinG the answers in two result setsMS 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. |
 |
|
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 LarssonHelsingborg, Sweden |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
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 |
 |
|
|
|
|
|
|