Finding Rows With Common Items

2012-07-12 Thread John Nichel
Hi all, Lets say I have a table with two colums: 'orderid' and 'productid'. This table contains line items for purchases in a store where a purchase could be 1 or more line items (1 or more rows). A typical order may look like this: orderid | productid 12345 | 9876 12345 | 6789 12345 |

Re: Finding Rows With Common Items

2012-07-12 Thread Shawn Green
On 7/12/2012 1:49 PM, John Nichel wrote: Hi all, Lets say I have a table with two colums: 'orderid' and 'productid'. This table contains line items for purchases in a store where a purchase could be 1 or more line items (1 or more rows). A typical order may look like this: orderid |

Re: Finding Rows With Common Items

2012-07-12 Thread Ananda Kumar
SQL select * from orddd; ORDERID PRODID -- -- 2 5 1 3 1 2 2 7 1 5 SQL select prodid,count(*) from orddd group by PRODID having count(*) 1; PRODID COUNT(*) --