I got an assignment, I could not fix it, can anybody help me:
Use a correlated subquery to return one row per customer, representing the customer’s most current order (the one with the latest date) with amount of sales tax greater than 100 dollars. Each row should include these four columns:EmailAddress, OrderID, OrderDate, and TaxAmount.
SELECT c.EmailAddress, o.TaxAmount, o.OrderDate, o.OrderID, o.CustomerID
FROM Customers AS c, Orders AS o
WHERE o.TaxAmount >100
Customers Table:
[CustomerID]
,[EmailAddress]
,[Password]
,[FirstName]
,[LastName]
,[ShippingAddressID]
,[BillingAddressID]
and Orders table has the following columns:
[OrderID]
,[CustomerID]
,[OrderDate]
,[ShipAmount]
,[TaxAmount]
,[ShipDate]
,[ShipAddressID]
,[CardType]
,[CardNumber]
,[CardExpires]
,[BillingAddressID]