Here is my problem....
There is a view which displays connection profit amounts for stores.
View CONN_PROFIT
DATE STORE_ID CONN_PROFIT
01-Sep-2001 603 56.00
01-Sep-2001 603 144.00
01-Sep-2001 603 500.00
01-Sep-2001 604 200.00
01-Sep-2001 605 56.00
01-Sep-2001 605 244.00
Then there is another view which holds the total NON_CONN_PROFIT for each store on a given day.
View NON_CONN_PROFIT
DATE STORE_ID NON_CONN_PROFIT
01-Sep-2001 603 300.00
01-Sep-2001 604 100.00
01-Sep-2001 605 500.00
I want to get the TOTAL PROFIT amount, so I'm trying to join these two tables, and this is what I'm getting....
DATE STORE_ID CONN_PROFIT NON_CONN_PROFIT
01-Sep-2001 603 56.00 300.00
01-Sep-2001 603 144.00 300.00
01-Sep-2001 603 500.00 300.00
01-Sep-2001 604 200.00 100.00
01-Sep-2001 605 56.00 500.00
01-Sep-2001 605 244.00 500.00
after joining, and then grouping the results gives me this....
DATE STORE_ID CONN_PROFIT NON_CONN_PROFIT
01-Sep-2001 603 700.00 900.00
01-Sep-2001 604 200.00 100.00
01-Sep-2001 605 300.00 1000.00
What I WANT is this....
DATE STORE_ID CONN_PROFIT NON_CONN_PROFIT
01-Sep-2001 603 700.00 300.00
01-Sep-2001 604 200.00 100.00
01-Sep-2001 605 300.00 500.00
The trouble is that the JOIN occurs first, joining every line in CONN_PROFIT with the NON_CONN profit amount, THEN it sums the results by the grouping I've specified.
What I need it to do is to group CONN_PROFIT first, then join the results with NON_CONN_PROFIT.
HELP !
There is a view which displays connection profit amounts for stores.
View CONN_PROFIT
DATE STORE_ID CONN_PROFIT
01-Sep-2001 603 56.00
01-Sep-2001 603 144.00
01-Sep-2001 603 500.00
01-Sep-2001 604 200.00
01-Sep-2001 605 56.00
01-Sep-2001 605 244.00
Then there is another view which holds the total NON_CONN_PROFIT for each store on a given day.
View NON_CONN_PROFIT
DATE STORE_ID NON_CONN_PROFIT
01-Sep-2001 603 300.00
01-Sep-2001 604 100.00
01-Sep-2001 605 500.00
I want to get the TOTAL PROFIT amount, so I'm trying to join these two tables, and this is what I'm getting....
DATE STORE_ID CONN_PROFIT NON_CONN_PROFIT
01-Sep-2001 603 56.00 300.00
01-Sep-2001 603 144.00 300.00
01-Sep-2001 603 500.00 300.00
01-Sep-2001 604 200.00 100.00
01-Sep-2001 605 56.00 500.00
01-Sep-2001 605 244.00 500.00
after joining, and then grouping the results gives me this....
DATE STORE_ID CONN_PROFIT NON_CONN_PROFIT
01-Sep-2001 603 700.00 900.00
01-Sep-2001 604 200.00 100.00
01-Sep-2001 605 300.00 1000.00
What I WANT is this....
DATE STORE_ID CONN_PROFIT NON_CONN_PROFIT
01-Sep-2001 603 700.00 300.00
01-Sep-2001 604 200.00 100.00
01-Sep-2001 605 300.00 500.00
The trouble is that the JOIN occurs first, joining every line in CONN_PROFIT with the NON_CONN profit amount, THEN it sums the results by the grouping I've specified.
What I need it to do is to group CONN_PROFIT first, then join the results with NON_CONN_PROFIT.
HELP !