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

Log in
Name

Password

 
 

History for Question2

??changed:
-
Question 2

  Get 'cid' values of customers who make orders _only_ through agent 'a03' and 
  'a05'.

  SQL::

    select cid 
        from customer 
        where cid in (
            select distinct ord_order_line.cid
                from ord_order_line, customer, product
                where ord_order_line.aid = 'a03' 
	           or ord_order_line.aid = 'a05') ;.


  Output::

      CID 
 
      c001
      c002
      c003
      c006

      4 record(s) selected.


<hr solid id=comments_below>


mj (Sep 15, 2001 10:52 pm; Comment #1)  --
 The inner select uses only the ord_order_line table, right? So the ', customer, product' part is not needed.