Hi all,
Hopefully there's a more simple way to do what I'm trying here - via some funky SQL code.
I have an item that is my best-selling line. I have created a table(A) containing all the people that have bought it in the last month, and another table(B) containing all of the other items that all of these people have bought, sorted by descending popularity (based on total sales).
I need to identify, for each customer in table A, the top 5 items in table B that they haven't already bought.
I was thinking of doing a cross-join on table A to a list of distinct items from B, then outer joining the result on buyer and item to identify the nulls (and therefore the non-existent buyer/item combinations), but it's clunky and my cross join will be potentially enormous.
Many thanks
wadjssd
Hopefully there's a more simple way to do what I'm trying here - via some funky SQL code.
I have an item that is my best-selling line. I have created a table(A) containing all the people that have bought it in the last month, and another table(B) containing all of the other items that all of these people have bought, sorted by descending popularity (based on total sales).
I need to identify, for each customer in table A, the top 5 items in table B that they haven't already bought.
I was thinking of doing a cross-join on table A to a list of distinct items from B, then outer joining the result on buyer and item to identify the nulls (and therefore the non-existent buyer/item combinations), but it's clunky and my cross join will be potentially enormous.
Many thanks
wadjssd