FrontPage
»
Question4
Question 4
Write a SQL query to get aid
values of agents who take orders from all
customers who live in Duluth. The aid
values should be reported in order
by decreasing percent commission.
SQL:
select distinct agent.aid, percent from agent, ord_order_line ool, customer where agent.aid = ool.aid and customer.cid = ool.cid and customer.city = 'Duluth' order by percent desc;
Output:
a04 11 a03 7 a01 6 a02 6 a05 5 a06 5
- mj (Sep 14, 2001 10:02 pm; Comment #1)
- This'll be my next problem to solve.
- mj (Sep 14, 2001 10:12 pm; Comment #2)
- Do you guys think I should wrap this statement in another select aid from () to elminate the percent column?