# SQL/Model for Customers Who Bought This Item Also Bought

**URL:** <https://www.ruby-forum.com/t/sql-model-for-customers-who-bought-this-item-also-bought/119815>\
**Category:** Rails\
**Created:** [November 10, 2007, 9:39pm UTC](https://www.ruby-forum.com/t/sql-model-for-customers-who-bought-this-item-also-bought/119815 "2007-11-10T21:39:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thabenksta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@thabenksta](https://www.ruby-forum.com/u/thabenksta)\
**Post date:** [November 10, 2007, 9:39pm UTC](https://www.ruby-forum.com/t/sql-model-for-customers-who-bought-this-item-also-bought/119815/1 "2007-11-10T21:39:45Z")

</div>

Hello.

We have a decent size Rails application that has worked great for us  
using ActiveRecord with minimal custom SQL here and there. However, now  
we need to develop a feature very similar to Amazon’s “Customers Who  
Bought This Item Also Bought” feature.

I’m looking for suggestions on best ways to handle this, via real-time  
using the actual table or a periodic process that updates a different  
table (e.g. nightly).

Any suggestions on how to design one or more tables would be greatly  
appreciated!

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![thabenksta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@thabenksta](https://www.ruby-forum.com/u/thabenksta)\
**Post date:** [November 11, 2007, 6:01am UTC](https://www.ruby-forum.com/t/sql-model-for-customers-who-bought-this-item-also-bought/119815/2 "2007-11-11T06:01:17Z")

</div>

On Nov 10, 12:39 pm, Ben K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Any suggestions on how to design one or more tables would be greatly  
> appreciated!
> 
> ## Thanks in advance.
> 
> Posted viahttp://www.ruby-forum.com/.

i searched on “rails +collaborative +filtering” and didn’t find much,  
but there are lots of papers on methodology.
