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 |
|
sheikh81
Starting Member
3 Posts |
Posted - 2011-09-27 : 12:58:56
|
| I need help with running total query in oracle.When I execute the query below:select count(order_id), platform_id from itc_com_order_headergroup by platform_idOutput:COUNT(ORDER_ID) PLATFORM_ID8 CC5 GC4520 GTI want something likeCOUNT(ORDER_ID) PLATFORM_ID Total8 CC 85 GC 134520 GT 4533Thanks in advance. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-27 : 13:05:07
|
| [code];with cte (cnt,platform_id)as(select count(order_id) , platform_id from itc_com_order_headergroup by platform_id)select c.*,c1.runcntfrom cte ccross apply (select sum(cnt) as runcnt from cte where platform_id<=c.platform_id)c1[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2011-09-27 : 13:09:02
|
| "in oracle"This is a Microsoft SQL Server forum, so you may not find people here who have good knowledge or Oracle I'm afraid. |
 |
|
|
sheikh81
Starting Member
3 Posts |
Posted - 2011-09-27 : 13:09:36
|
| visakh16; thanks for such a quick response, I tried to execute this and getting "missing keyword" toad error on the cross apply. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-27 : 13:13:05
|
| sorry didnt realise you're on oracle. if yes, this is wrong forum to post. As Kristen suggested post in some Oracle forums like www.dbforums.com------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
sheikh81
Starting Member
3 Posts |
Posted - 2011-09-27 : 13:19:17
|
| Thank You all :) |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2011-09-27 : 13:24:54
|
| @Visakh : I was getting ready to eat my hat if that had just run, as-is, on Oracle! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-27 : 13:27:18
|
quote: Originally posted by Kristen @Visakh : I was getting ready to eat my hat if that had just run, as-is, on Oracle!
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|