Answer the question
In order to leave comments, you need to log in
How to display the names of buyers whose order was shipped after the required date?
Hello!
I have 2 tables - Orders , Customers
in Orders there are columns RequiredDate, ShippedDate
in Customers column ContactName
I need to find out the names of those whose orders were shipped after RequiredDate, during 1997
What I did: Select distinct contactname,orderdate from customers left join orders on year(orderdate) = 1997
how to find out which orders were sent after RequiredDate?
Answer the question
In order to leave comments, you need to log in
orders on->
WHERE
SELECT Customers.ContactName, COUNT(Orders.ID) AS [Число просроченных]
FROM Customers INNER JOIN Orders ON Customers.ID = Orders.Customer
WHERE (Orders.RequiredDate < Orders.ShippedDate)
GROUP BY Customers.ContactName
HAVING (COUNT(Orders.ID) > 0)
ORDER BY Customers.ContactName
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question