View Single Post

   
  #1 (permalink)  
Old 06-13-2008, 02:59 PM
Nathan G
 
Posts: n/a
Default need help creating query

I need help writing a query that returns productIds for products that
are in the same order as a given productId. (Customers who purchased
this also bought...)

I have three tables, here they are with their relevant columns.

ORDERS
oid

ORDERS_CONTENT
ocid
oid
pid

PRODUCTS
pid

I need to select all pid (product Ids) from orders_content where a
product Id (we'll use #5 for this example) is in that same order.

So if someone places an order for products #5 and #12, the query would
return pid 12.

Thanks!
Reply With Quote