|
Question : Merge Two Crosstab Queries
|
|
I have the following two crosstab queries that i would like to merge into one query so that i can receive all of the data in a single recordset.
Query1: TRANSFORM Sum(FINANH.RECEIVED - FINANH.COSTS) AS SumOfRECEIVED SELECT HISTORY.FORW_NO FROM HISTORY INNER JOIN FINANH ON HISTORY.FILENO = FINANH.FILENO WHERE FINANH.TYPE = 'B' AND ((FINANH.TRANS_DATE) BETWEEN #1/1/2007# AND #12/31/2007#) AND ((HISTORY.DATE_RECD) BETWEEN #1/1/2007# AND #12/31/2007#)) GROUP BY FORW_NO ORDER BY FORW_NO PIVOT Format([DATE_RECD],'mmm') In ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
Query2: TRANSFORM Sum(FINAN.RECEIVED - FINAN.COSTS) AS SumOfRECEIVED SELECT MASTER.FORW_NO FROM MASTER INNER JOIN FINAN ON MASTER.FILENO = FINAN.FILENO WHERE FINAN.TYPE = 'B' AND ((FINAN.TRANS_DATE) BETWEEN #1/1/2007# AND #12/31/2007#) AND ((MASTER.DATE_RECD) BETWEEN #1/1/2007# AND #12/31/2007#)) GROUP BY FORW_NO ORDER BY FORW_NO PIVOT Format([DATE_RECD],'mmm') In ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
Note that History and Master tables are identical except for the fact that History contains information about closed accounts and Master provides information about open accounts. I am trying to get all of the information on all accounts, opened or closed. Also note FINAN and FINANH tables are identical as well except that FINANH table contains information regarding closed accounts and FINAN table contains information regarding open accounts.
I just want all the accounts, closed and open, to have their information added together and grouped by the FORW_NO field and I have had no luck. Any and all ideas are welcome and appreciated.
|
|
Answer : Merge Two Crosstab Queries
|
|
Turns out I had made a mistake table defs were different hence the error.
|
|
|
|