rollup

ROLLUP Function; Replace NULL with 'Total' w/ Column data type INT not VARCHAR

和自甴很熟 提交于 2019-12-05 20:11:44
I'm having some problems replacing my ROLLUP NULL with a string value because my column data type is an Integer. SELECT CASE WHEN GROUPING(Column1) = 1 THEN 'Total' ELSE Column1 END Column1, SUM(Column2) AS MySum FROM MyTable GROUP BY Column1 WITH ROLLUP; I can put a numeric value in: WHEN GROUPING(Column1) = 1 THEN '9999' but I can't figure out how to convert to varchar if value is NULL and then replace with 'Total'. Test Data DECLARE @MyTable TABLE (Column1 INT,Column2 INT) INSERT INTO @MyTable VALUES (1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3) SELECT CASE WHEN GROUPING(Column1) =

Is there a way to simulate GROUP BY WITH CUBE in MySql?

瘦欲@ 提交于 2019-12-05 09:10:38
MySql supports GROUP BY WITH ROLLUP which will return aggregates for the last x of the n columns in the group by but does not support GROUP BY WITH CUBE to take all combinations of the n columns and take aggregates. I can simulate this by doing unions of GROUP BY WITH ROLLUP queries, but MySql is materializing my subquery multiple times. I am using a group by on a large subquery, so this is suboptimal. Is there a way to solve this without temporary tables? Short answer: No. Long answer: You may install an open source data warehouse with GROUP BY WITH CUBE support which is using Mysql as a

I would like to combine ROLLUP with PIVOT - is that an option?

半城伤御伤魂 提交于 2019-12-05 02:56:24
问题 I have been using SELECT Author, ISNULL(MAX(CASE Status WHEN 'Duplicate' THEN NumDocs END),'') AS Duplicate, ISNULL(MAX(CASE Status WHEN 'Failure' THEN NumDocs END),'') AS Failure, ISNULL(MAX(CASE Status WHEN 'Rejected' THEN NumDocs END),'') AS Rejected, ISNULL(MAX(CASE Status WHEN 'Success' THEN NumDocs END),'') AS Success, ISNULL(MAX(CASE Status WHEN 'TOTAL' THEN NumDocs END),'') AS TOTAL FROM (SELECT CASE WHEN (GROUPING(Author)=1) THEN 'ALL' ELSE ISNULL(Author,'UNKNOWN') END AS Author,

Angular AOT & Rollup - Could not resolve 'app.module.ngfactory'

╄→гoц情女王★ 提交于 2019-12-04 23:48:39
问题 I am trying to complete Angular's AOT tutorial: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html Using ngc part works and it generates aot folder. However, when it comes to tree-shaking with rollup part, I bump into this error: Error: Could not resolve '../aot/app/app.module.ngfactory' from ...\app\main-aot.js at Error (native) at ...\node_modules\rollup-plugin-node-resolve\dist\rollup-plugin-node-resolve.cjs.js:78:21 at ...\node_modules\resolve\lib\async.js:56:18 at load (...

Error: Illegal reassignment to import

▼魔方 西西 提交于 2019-12-04 04:59:06
I am trying to import a module into a typescript file and then bundle with Rollup.js. But I am getting an error message which prevents Rollup from completing. The import: import * as mapboxgl from 'mapbox-gl'; (mapboxgl as any).accessToken = this.accessToken; this.map = new mapbox.Map({...}); When I run tsc there is not any error messages, but then when I run: $ rollup -c rollup.config.js Illegal reassignment to import 'mapboxgl' Error: Illegal reassignment to import 'mapboxgl' at error (C:\Users\m.wilson\AppData\Roaming\npm\node_modules\rollup\src\utils\error.js:2:14) at

SQL SERVER T-SQL Calculate SubTotal and Total by group

淺唱寂寞╮ 提交于 2019-12-04 01:30:23
问题 I am trying to add subtotal by group and total to a table. I've recreated the data using the following sample. DECLARE @Sales TABLE( CustomerName VARCHAR(20), LegalID VARCHAR(20), Employee VARCHAR(20), DocDate DATE, DocTotal Int, DueTotal Int ) INSERT INTO @Sales SELECT 'Jhon Titor','12345', 'Employee1','2015-09-01',1000,200 INSERT INTO @Sales SELECT 'Jhon Titor','12345', 'Employee1','2015-08-20',500,100 INSERT INTO @Sales SELECT 'Jhon Titor','12345', 'Employee1','2015-08-18',200,50 INSERT

I would like to combine ROLLUP with PIVOT - is that an option?

荒凉一梦 提交于 2019-12-03 17:26:26
I have been using SELECT Author, ISNULL(MAX(CASE Status WHEN 'Duplicate' THEN NumDocs END),'') AS Duplicate, ISNULL(MAX(CASE Status WHEN 'Failure' THEN NumDocs END),'') AS Failure, ISNULL(MAX(CASE Status WHEN 'Rejected' THEN NumDocs END),'') AS Rejected, ISNULL(MAX(CASE Status WHEN 'Success' THEN NumDocs END),'') AS Success, ISNULL(MAX(CASE Status WHEN 'TOTAL' THEN NumDocs END),'') AS TOTAL FROM (SELECT CASE WHEN (GROUPING(Author)=1) THEN 'ALL' ELSE ISNULL(Author,'UNKNOWN') END AS Author, CASE WHEN (GROUPING(Status )=1) THEN 'TOTAL' ELSE ISNULL(Status ,'UNKNOWN') END AS [Status], COUNT(Status)

Rollup Error: 'isValidElementType' is not exported by node_modules/react-is/index.js

风格不统一 提交于 2019-12-03 10:58:05
I'm building a bundle with rollUp using styled-components. My rollup.config.js looks like: import resolve from 'rollup-plugin-node-resolve' import babel from 'rollup-plugin-babel' import commonjs from 'rollup-plugin-commonjs' export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'cjs' }, external: [ 'react', 'react-proptypes' ], plugins: [ resolve({ extensions: [ '.js', '.json', '.jsx' ] }), commonjs({ include: 'node_modules/**' }), babel({ exclude: 'node_modules/**' }) ] } And I'm receiving [!] Error: 'isValidElementType' is not exported by node_modules/react-is

oracle rollup function with multiple columns

我怕爱的太早我们不能终老 提交于 2019-12-03 10:40:52
问题 I've a simple query: WITH data(val1, val2, val3) AS ( SELECT 'a' ,'a-details' ,'1' FROM DUAL UNION ALL SELECT 'b' ,'b-details' ,'2' FROM DUAL UNION ALL SELECT 'c' ,'c-details' ,'3' FROM DUAL ) SELECT NVL(val1,'Total Result'), val2, SUM(val3) tot from data group by rollup(val1, val2); I get an output like: VAL1 VAL2 TOT -------------------------------- -------------------------------- ---------- a a-details 1 a 1 b b-details 2 b 2 c c-details 3 c 3 Total Result 6 But I need an output like:

How to display products under Category in sql in a table

﹥>﹥吖頭↗ 提交于 2019-12-02 21:29:37
问题 I have the following table: where the products are in different categories and i am excepting the output: like product and its cost need to be displayed under category(For category cost value i want to display total products cost) .I tried with different approaches by using roll up and grouping , but i am not getting excepted output. 回答1: Here it goes: Sample Data: CREATE TABLE #product (ID INT, Category VARCHAR(50), Product VARCHAR(50), Value INT) INSERT INTO #product VALUES(1,'Non-veg',