You are not logged in Log in Join
You are here: Home » Members » MJ's corner on Zope » QuantumPythons » Question6

Log in
Name

Password

 
 

History for Question6

??changed:
-
Question 6

  Get 'cid's of customers who order **both** product 'p01' and product 'p07'.  
  This means the customer has ordered 'p01' and also 'p07'. These two products 
  do not have to be on the same order but the customer must have ordered both 
  products sometime.

  SQL::

    (
        select distinct cid 
            from ord_order_line 
            where pid = 'p01'
    )
    intersect
    (
        select distinct cid 
            from ord_order_line 
            where pid = 'p07'
    );

  Output::

    c001
    c006

<hr solid id=comments_below>


mj (Sep 17, 2001 7:34 pm; Comment #1)  --
 This one is *mine*! All **mine**!! *Hahahahaha!!!!!*
 
 *"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind."* - Terry Pratchett, Eric