?
Solved

Help with query against AdventureWorks database - Products ordered

Posted on 2010-08-28
8
Medium Priority
?
363 Views
Last Modified: 2012-06-21
Need a hand with this query:

Return the First Name, Last Name, Product Name, and Sale Price for all products ordered in the month of November 2001.

Thanks!
0
Comment
Question by:John500
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
8 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 33551324
John500,

Post what you have so far on this and the exact difficulty you are having in producing the query. Hopefully through the other questions you have learned a bit about joins and filtering data that this should become easier as you go along.

Kevin
0
 

Author Comment

by:John500
ID: 33551376
Terrific, will do!
0
 

Author Comment

by:John500
ID: 34107760
As I remember now, the thing that was making this question so difficult was finding a field called FirstName and LastName related to customers.  Any input here?

Thanks
0
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 

Author Comment

by:John500
ID: 34111973
Never mind on that last one.  The data dictionary was the ticket as mentioned before in the other questions
0
 

Author Comment

by:John500
ID: 34135815
For whatever it's worth, I would think the recommended price would be the selling price minus the discounted price.  I say that because there are only a few options here:

SalesOrderDetail Table
-------------------------------
UnitPrice                    |   money  |  Not null    |     Selling price of a single product.
UnitPriceDiscount      |   money  |  Not null    |     Discount amount.

Product Table
-------------------------------
StandardCost            |  money   |   Not null   |     Standard cost of the product.
ListPrice                    |  money   |   Not null   |     Selling price.

Is there any other way to get a derived or recommended selling price other than the discount?

 

 
0
 

Accepted Solution

by:
John500 earned 0 total points
ID: 34137032
Ended up going with this:

SELECT FirstName, LastName, PP.Name AS 'Product Name', UnitPrice AS 'Sales Price', OrderDate
FROM Sales.Store AS S
JOIN Sales.SalesOrderHeader AS SO ON S.CustomerID = SO.CustomerID
JOIN Sales.SalesOrderDetail AS SD ON SD.SalesOrderID = SO.SalesOrderID
JOIN Production.Product AS PP ON PP.ProductID = SD.ProductID
JOIN Person.Contact AS PC ON PC.ContactID = S.CustomerID
WHERE OrderDate > '2001-10-31' AND OrderDate < '2001-12-01'
0
 

Author Closing Comment

by:John500
ID: 34186349
Query is accurate
0

Featured Post

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question