Return Customers with > 1 Orders of Specific Product??

  • I apologize if I am posting in the wrong area. I don't even know how to search this forum for the answer to this one. I am a newbie as you'll see:

     

    I have a table in which orders are kept. I have a customerid and a productid. I need to return only the customerid's for those who have ordered > 1 of a specific peoductid.

     

    This sounds really simple but I've never had to do this. I tried to use a count(*) > 1 but to no avail.

     

    Is there any hope of finding this? I've left my sql reference at home and the client is coming to see in the AM ;(

     

    TIA: Rich

  • If i understand you correctly something along the lines of

    SELECT CUSTOMERID, PRODUCTID

    FROM TABLE

    GROUP BY CUSTOMER ID, PRODUCTID

    HAVING COUNT(*) > 1

    hth

    Dave

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply