# What am I doing wrong?

• ### Question

• Need to Solve this:
• For each order, display the Company Name, City, and the Country for the customer who placed the order.

Include the Order Date and the Required Date. Order the results by Company Name in ascending order.

830 rows returned.

USE [Northwind]

GO

SELECT Customers.CompanyName, Customers.City, Customers.Country, Orders.OrderID, Orders.OrderDate, Orders.RequiredDate

FROM Customers INNER JOIN [Orders]

ON Customers.CustomerID = Orders.CustomerID

SELECT Orders.OrderDate

FROM Orders

WHERE OrderDate BETWEEN '03-01-1997' AND '03-30-1997'

ORDER BY CompanyName ASC

GO

Teresa Halderman

Monday, September 10, 2012 7:52 PM

• ```SELECT
Customers.CompanyName,
Customers.City,
Customers.Country,
Orders.OrderID,
Orders.OrderDate,
Orders.RequiredDate
FROM Customers INNER JOIN [Orders]
ON Customers.CustomerID = Orders.CustomerID
Where orderDate between '19970301' and 19970303'
ORDER BY CompanyName ASC```
• Proposed as answer by Tuesday, September 11, 2012 10:35 AM
• Marked as answer by Tuesday, September 11, 2012 3:07 PM
Tuesday, September 11, 2012 10:35 AM

### All replies

• Perhaps what you need is something like this:

```SELECT
Customers.CompanyName,
Customers.City,
Customers.Country,
Orders.OrderID,
Orders.OrderDate,
Orders.RequiredDate
FROM Customers INNER JOIN [Orders]
ON Customers.CustomerID = Orders.CustomerID
Where orderDate between '19970301' and 19970303'
ORDER BY CompanyName ASC
;```

• Proposed as answer by Tuesday, September 11, 2012 7:21 AM
• Marked as answer by Tuesday, September 11, 2012 3:07 PM
• Unmarked as answer by Tuesday, September 11, 2012 3:08 PM
Monday, September 10, 2012 8:00 PM
• Almost done

USE [Northwind]

GO

SELECT Customers.CompanyName, Customers.City, Customers.Country, Orders.OrderID, Orders.OrderDate,Orders.RequiredDate

FROM Customers INNER JOIN [Orders]

ON Customers.CustomerID = Orders.CustomerID

WHERE OrderDate BETWEEN '03-01-1997' AND '03-30-1997'

ORDER BY CompanyName ASC

GO

Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

MS SQL optimization: MS SQL Development and Optimization
MS SQL Blog: Large scale of database and data cleansing
MS SQL Consultants: Improves MS SQL Database Performance

Tuesday, September 11, 2012 7:22 AM
• ```SELECT
Customers.CompanyName,
Customers.City,
Customers.Country,
Orders.OrderID,
Orders.OrderDate,
Orders.RequiredDate
FROM Customers INNER JOIN [Orders]
ON Customers.CustomerID = Orders.CustomerID
Where orderDate between '19970301' and 19970303'
ORDER BY CompanyName ASC```
• Proposed as answer by Tuesday, September 11, 2012 10:35 AM
• Marked as answer by Tuesday, September 11, 2012 3:07 PM
Tuesday, September 11, 2012 10:35 AM