Use of oracle
Table structure:
Company code (key) management code (key) department code customer code date (format: YYYYMMDD) transactions
111 0001 20130101 1000 01 V001
111 0002 20130201 20000 01 V001
111 0003 20130212 2000 01 V001
111 0004 20130201 200000 01 V001
111 0005 20130303 3000 01 V001
111 0006 20130305 5000 01 V001
The extraction results:
in January, February and marchRecord1, 1000, 20000, 3000
Record2 null value 2000 5000
Record3 null null value 200000
Note: same customer is looking for the same department monthly data, but the number of article each month of data may not, also could not, did not use null values...
CodePudding user response:
I am using is Oracle, as follows:The SELECT management code, department code, customer code, SUBSTR (dates, 5, 2) the MONTH, COUNT (1) the FROM CNT TABLE_ turnover
WHERE SUBSTR (date, 1, 4)='2013'
GROUP BY management code, department code, customer code, SUBSTR (dates, 5, 2);
The SELECT management code, department code, customer code, the MONTH,
NVL (SUM (DECODE (MONTH, '01, CNT, 0)), 0) AS "in January,"
NVL (SUM (DECODE (MONTH, '02, CNT, 0)), 0) AS "in February,"
NVL (SUM (DECODE (MONTH, '03, CNT, 0)), 0) AS "march",
NVL (SUM (DECODE (MONTH, '04, CNT, 0)), 0) AS "April",
NVL (SUM (DECODE (MONTH, '05, CNT, 0)), 0) AS "may",
NVL (SUM (DECODE (MONTH, '06, CNT, 0)), 0) AS "June",
NVL (SUM (DECODE (MONTH, '07, CNT, 0)), 0) AS "July",
NVL (SUM (DECODE (MONTH, '08', CNT, 0)), 0) AS "August",
NVL (SUM (DECODE (MONTH, '09, CNT, 0)), 0) AS "September",
NVL (SUM (DECODE (MONTH, '10', CNT, 0)), 0) AS "October",
NVL (SUM (DECODE (MONTH, '11', CNT, 0)), 0) AS "November",
NVL (SUM (DECODE (MONTH, '12, CNT, 0)), 0) AS "December" FROM (
The SELECT management code, department code, customer code, SUBSTR (dates, 5, 2) the MONTH, COUNT (1) the FROM CNT TABLE_ turnover
WHERE SUBSTR (date, 1, 4)='2013'
GROUP BY management code, department code, customer code, SUBSTR (dates, 5, 2))
GROUP BY management code, department code, customer code, the MONTH
CodePudding user response:
Is actually a transformation problem,CodePudding user response:
Fluctuate in SQL as well with controls directlyQuery to the data set and then set up relevant properties can connect CxPivotGrid data source!
CodePudding user response:
OracleDatabase ah, I haven't even started yet
CodePudding user response: