467,911 Members | 1,376 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,911 developers. It's quick & easy.

Cube/Rollup without Group By?

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 proc with 25 fields, and have
no desire to Group By anything- when a certain field changes, I just
want a row with the total of that field.

Is this possible?

Thanks,

Burt
Jul 20 '05 #1
  • viewed: 7141
Share:
2 Replies
Not totally sure what you are asking, but maybe COMPUTE will do what you need.

SELECT col1, col2
from t1
COMPUTE SUM(col1)

Non-standard SQL I believe but occasionally useful.
Mike John

"Burt" <bu*******@yahoo.com> wrote in message news:19**************************@posting.google.c om...
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 proc with 25 fields, and have
no desire to Group By anything- when a certain field changes, I just
want a row with the total of that field.

Is this possible?

Thanks,

Burt


Jul 20 '05 #2
You might find it necessary to put all the columns in the "select" clause
also into the "group by" clause, where you can then add a "rollup" or "cube"
clause. You might also find it useful to add a suitable "order by" clause.

Goetz Graefe
Microsoft SQL Server development -- Comments given as personal opinions and
suggestions only.

"Burt" <bu*******@yahoo.com> wrote in message
news:19**************************@posting.google.c om...
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 proc with 25 fields, and have
no desire to Group By anything- when a certain field changes, I just
want a row with the total of that field.

Is this possible?

Thanks,

Burt

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by UNIXNewBie | last post: by
1 post views Thread by Frank Py | last post: by
reply views Thread by Fan Ruo Xin | last post: by
1 post views Thread by js | last post: by
3 posts views Thread by apattin | last post: by
kiss07
2 posts views Thread by kiss07 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.