Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hi
I am generating a pivot table using the following query SELECT `'1100 REG$'`.`Ap/ArID`, `'1100 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1100 REG$'` `'1100 REG$'` UNION SELECT `'1157 REG$'`.`Ap/ArID`, `'1157 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1157 REG$'` `'1157 REG$'` UNION SELECT `'1165 REG$'`.`Ap/ArID`, `'1165 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1165 REG$'` `'1165 REG$'` The problem I am having is that I am getting a difference in the total amount when the same query is generated individually for 1100 REG, 1157 REG and 1165REG and aggregated. Why? |
#2
![]() |
|||
|
|||
![]()
Try UNION ALL instead of UNION.
nc wrote: Hi I am generating a pivot table using the following query SELECT `'1100 REG$'`.`Ap/ArID`, `'1100 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1100 REG$'` `'1100 REG$'` UNION SELECT `'1157 REG$'`.`Ap/ArID`, `'1157 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1157 REG$'` `'1157 REG$'` UNION SELECT `'1165 REG$'`.`Ap/ArID`, `'1165 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1165 REG$'` `'1165 REG$'` The problem I am having is that I am getting a difference in the total amount when the same query is generated individually for 1100 REG, 1157 REG and 1165REG and aggregated. Why? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
#3
![]() |
|||
|
|||
![]()
Hi Debra
Thanks, it works. What is the differene between the two? "Debra Dalgleish" wrote: Try UNION ALL instead of UNION. nc wrote: Hi I am generating a pivot table using the following query SELECT `'1100 REG$'`.`Ap/ArID`, `'1100 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1100 REG$'` `'1100 REG$'` UNION SELECT `'1157 REG$'`.`Ap/ArID`, `'1157 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1157 REG$'` `'1157 REG$'` UNION SELECT `'1165 REG$'`.`Ap/ArID`, `'1165 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1165 REG$'` `'1165 REG$'` The problem I am having is that I am getting a difference in the total amount when the same query is generated individually for 1100 REG, 1157 REG and 1165REG and aggregated. Why? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
#4
![]() |
|||
|
|||
![]()
By default, UNION excludes duplicate records. UNION ALL retains the
duplicate values. nc wrote: Hi Debra Thanks, it works. What is the differene between the two? "Debra Dalgleish" wrote: Try UNION ALL instead of UNION. nc wrote: Hi I am generating a pivot table using the following query SELECT `'1100 REG$'`.`Ap/ArID`, `'1100 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1100 REG$'` `'1100 REG$'` UNION SELECT `'1157 REG$'`.`Ap/ArID`, `'1157 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1157 REG$'` `'1157 REG$'` UNION SELECT `'1165 REG$'`.`Ap/ArID`, `'1165 REG$'`.Amount FROM `F:\Finance\Income Reconciliation\2004-05\GL transactions 0405`.`'1165 REG$'` `'1165 REG$'` The problem I am having is that I am getting a difference in the total amount when the same query is generated individually for 1100 REG, 1157 REG and 1165REG and aggregated. Why? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
grouping data in a pivot table | Excel Discussion (Misc queries) | |||
HOw do I display text in the data field of the pivot table, inste. | Excel Worksheet Functions | |||
I am having problems creating pivot table of data | Charts and Charting in Excel | |||
Using Microsoft Query data in a pivot table. | Charts and Charting in Excel | |||
Pivot Table - Group by Month - Show Items with no data | Excel Discussion (Misc queries) |