David wrote:
>
> Does anyone know how to do a "people who bought this also bought that"
> type query?
>





We store what people bought into a table called itempairs at checkout.

Basically we make a permutation or matrix of all possible combinations 
of sku's

so if a customer bought sku1, sku2 and sku3, we insert

master -- related
sku1 sku2
sku1 sku3
sku2 sku1
sku2 sku3
sku3 sku1
sku3 sku2


on our sku2 product page, we do a query to get all related fields where 
master = sku2, sort by count, limit 3.



You could also do this without an itempairs table, but its more resource 
intensive to go through your complete order history table getting all 
the skus per order and then sorting them.

Reply via email to