9 lines
376 B
MySQL
9 lines
376 B
MySQL
|
/*7. Write a query to create a view that finds the salesman who has the customer with the highest order of a day. */
|
||
|
CREATE VIEW elitsalesman
|
||
|
AS SELECT b.ord_date, a.salesman_id, a.name
|
||
|
FROM salesman a, orders b
|
||
|
WHERE a.salesman_id = b.salesman_id
|
||
|
AND b.purch_amt =
|
||
|
(SELECT MAX (purch_amt)
|
||
|
FROM orders c
|
||
|
WHERE c.ord_date = b.ord_date);
|