Well the best way of explaining I can think of is using an example...
Let's say I have two tables:
STORE_A_CUSTOMER_TRAN
CUSTOMER_NO TRAN_TYPE_CD ...
111 Z ...
111 Z ...
222 Z ...
...
STORE_B_CUSTOMER_TRAN
CUSTOMER_NO TRAN_TYPE_CD ...
111 Y ...
222 Y ...
333 Y ...
...
What I am trying to get is a distinct or grouped by list of all of the customer_no's from both tables. So if customer 1 has transactions stored in both tables while customer 2 has transactions only in the store B table, I want my results to only return "customer 1, customer 2"... So basically I am looking for something like:
SELECT A.CUSTOMER_NO, B.CUSTOMER_NO
FROM STORE_A_CUSTOMER_TRAN A,
STORE_B_CUSTOMER_TRAN B
WHERE A.TRAN_TYPE_CD = 'Z'
AND B.TRAN_TYPE_CD = 'Y'
GROUP BY (A.CUSTOMER_NO, B.CUSTOMER_NO);
So using my example tables above I want my results to be:
CUSTOMER_NO
111
222
333
This is more-or-less the method behind my madness. A customer may exist in one, or both tables. Essentially I've got two separate queries, I'm just looking for a way group their results. Any assistance would be GREATLY appreciated
Thanks!
Let's say I have two tables:
STORE_A_CUSTOMER_TRAN
CUSTOMER_NO TRAN_TYPE_CD ...
111 Z ...
111 Z ...
222 Z ...
...
STORE_B_CUSTOMER_TRAN
CUSTOMER_NO TRAN_TYPE_CD ...
111 Y ...
222 Y ...
333 Y ...
...
What I am trying to get is a distinct or grouped by list of all of the customer_no's from both tables. So if customer 1 has transactions stored in both tables while customer 2 has transactions only in the store B table, I want my results to only return "customer 1, customer 2"... So basically I am looking for something like:
SELECT A.CUSTOMER_NO, B.CUSTOMER_NO
FROM STORE_A_CUSTOMER_TRAN A,
STORE_B_CUSTOMER_TRAN B
WHERE A.TRAN_TYPE_CD = 'Z'
AND B.TRAN_TYPE_CD = 'Y'
GROUP BY (A.CUSTOMER_NO, B.CUSTOMER_NO);
So using my example tables above I want my results to be:
CUSTOMER_NO
111
222
333
This is more-or-less the method behind my madness. A customer may exist in one, or both tables. Essentially I've got two separate queries, I'm just looking for a way group their results. Any assistance would be GREATLY appreciated
Thanks!