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 |
xal_kaushi
Starting Member
3 Posts |
Posted - 2012-12-21 : 07:35:41
|
Hi All, i have a table and i want count as well as sum together eg belowStatus ----Count 1 ---- 22 ----- 33 ---- 44 ---- 5Total ---- 14 i want this output how to get it pls help me for count i am using this query select status,count(*) from table group by statuspls let me know which query is used to generate above output.thanks in advance :) |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2012-12-21 : 07:40:36
|
select status,count(*) from table group by ROLLUP(status)--Chandu |
|
|
xal_kaushi
Starting Member
3 Posts |
Posted - 2012-12-21 : 07:42:30
|
quote: Originally posted by bandi select status,count(*) from table group by ROLLUP(status)--Chandu
HI Chandu thanks for info pls tell me what is rollup for ?? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
xal_kaushi
Starting Member
3 Posts |
Posted - 2012-12-21 : 08:07:28
|
HiAll it is showing error undefined function is it work in toad also oracleor it should be used with case statement only . |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2012-12-21 : 08:20:28
|
quote: Originally posted by xal_kaushi HiAll it is showing error undefined function is it work in toad also oracleor it should be used with case statement only .
In oracle also there is Rollup function... This is SQL Server related forums. You can get better and quick solutions from Oracle forums like www.dbforums.com--Chandu |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-12-21 : 09:07:21
|
quote: Originally posted by xal_kaushi HiAll it is showing error undefined function is it work in toad also oracleor it should be used with case statement only .
whats the error? Did you try it in SSMS also?whats need of CASE statement?If you're running against Oracle DB then better to post in relevant forums------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|