Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We have two production sites: Portland and Seattle. (Hint: look for Production tables) Create a combined list of all products from both sites, including at

We have two production sites: Portland and Seattle. (Hint: look for Production tables)

Create a combined list of all products from both sites, including at least the name, number, cost, and price of the products. And please sort it intelligently. (There should be 140 rows, not 128 rows!)

SELECT 'Seattle' AS ProductionSite, p.ProductID, p.Name, pc.StandardCost, sod.UnitPrice
FROM Production.Product AS p
JOIN Production.ProductCostHistory AS pc ON p.ProductID = pc.ProductID
JOIN Sales.SalesOrderDetail AS sod ON p.ProductID = sod.ProductID
WHERE EXISTS (SELECT * FROM Production.ProductInventory AS pi WHERE p.ProductID = pi.ProductID AND pi.LocationID = 1)
union
SELECT 'Portland' AS ProductionSite, p.ProductID, p.Name, pc.StandardCost, sod.UnitPrice
FROM Production.Product AS p
JOIN Production.ProductCostHistory AS pc ON p.ProductID = pc.ProductID
JOIN Sales.SalesOrderDetail AS sod ON p.ProductID = sod.ProductID
WHERE EXISTS (SELECT * FROM Production.ProductInventory AS pi WHERE p.ProductID = pi.ProductID AND pi.LocationID = 1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Nature Of Mathematics

Authors: Karl J. Smith

13th Edition

1133947255, 978-1133947257

More Books

Students also viewed these Accounting questions