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

Log in
Name

Password

 
 
FrontPage »

Question2

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.


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.