- 1
Oracle Sql Problem
Find the names of the customers who have two or more orders with status "pending." Customers(custID, name, email, shipAddr) Orders(orderID, custID, itemID, date, status) Items(itemID, description)
2 Answers
0
Join should help.
Select Customers.name
From Customers
Inner join Orders ON
Customers.custID=Orders.custId
Where Orders.status = "pending";
If not exactly, it should be something similar to the above query.
0
"two or more" sounds like the important part
select c.name
from customers c
join (
select custID, count(*)
from orders
where status='pending'
group by custID
having count(*)>=2
) o on o.custID = c.custID