Solved

Help with query against AdventureWorks database - Products ordered

Posted on 2010-08-28
8
361 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

707 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