Solved

Help with query against AdventureWorks database - Products ordered

Posted on 2010-08-28
8
355 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
  • 6
8 Comments
 
LVL 59

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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…

785 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