Hi all
I am trying to do some Multi Product Affinity analysis. Database is sql 2008. The Business Question is
When customers purchased product A and Product B in one transaction, what other product/s did they purchase in the same transaction. See the sample data below. In this example , if I choose product '2008' and '2009' then the output expected is
Associated_Product qty
2006 1
Thank you
Transaction Header | ||||
Transaction_ID | Order_Amt | |||
80268 | 23 | |||
80270 | 10 | |||
80271 | 12 | |||
Transaction_Detail | ||||
Transaction ID | Line No | Product_ID | Qty | Amt |
80268 | 100 | 2008 | 2 | 10 |
80268 | 101 | 2009 | 1 | 6 |
80268 | 102 | 2006 | 1 | 7 |
80270 | 103 | 2008 | 2 | 10 |
80271 | 104 | 2008 | 1 | 5 |
80271 | 105 | 2006 | 1 | 7 |