Skip to content

Tag: rollup

SQL ROLLUP with COALESCE

The data: The query: The output I get is like this: It gives null every individual brand item not grouped, and I want the last null to be ‘Grand Total’ not ‘Monthly Total’. I tried putting PurchaseDate or Brand column in and out the ROLLUP but it doesn’t seem to work for the Bran…

SQL Grand total without subtotals

I’m making a large SQL report in Orderwise, very roughly simplified as follows; I want a grand total at the bottom, without a bunch of subtotals dotted in throughout the report – therefore I don’t think I can use ROLLUP. The Subquery in there is of course a sub query and in the real thing th…

oracle sum by column without using union

I have this table: (supply table: how many products in storages) I should write a query to have this result: “Total_except_storage_30” has the total of every product in storages except storage number 30. For example first “total_except_storage_30” is for product_id 1000 in all storages…

Convert a running total oracle sql query to a final total

I have the following query that works and gets me the total that I need. However, i need to change it so that it just displays the final total instead of every transaction leading up to the total. I have tried converting it by group by rollup, group by group sets, using max transaction number, but my total ne…