You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
programming-examples/sql/Joins/Write a SQL statement to fi...

10 lines
491 B
SQL

/*Write a SQL statement to find the details of a order i.e. order number, order date, amount of order, which customer gives the
order and which salesman works for that customer and how much commission he gets for an order.*/
SELECT a.ord_no,a.ord_date,a.purch_amt,
b.cust_name AS "Customer Name", b.grade,
c.name AS "Salesman", c.commission
FROM orders a
INNER JOIN customer b
ON a.customer_id=b.customer_id
INNER JOIN salesman c
ON a.salesman_id=c.salesman_id;