programming-examples/sql/Joins/Write a SQL statement to make a report with customer name, city, order no. order date, purchase amount for only those customers on the list who must have a grade and placed.sql

9 lines
491 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*Write a SQL statement to make a report with customer name, city, order no. order date, purchase amount for only those customers
on the list who must have a grade and placed one or more orders or which order(s) have been placed by the customer who is neither
in the list not have a grade.*/
SELECT a.cust_name,a.city, b.ord_no,
b.ord_date,b.purch_amt AS "Order Amount"
FROM customer a
FULL OUTER JOIN orders b
ON a.customer_id=b.customer_id
WHERE a.grade IS NOT NULL;