0

makeflag=1 を持つすべての行の listprice に基づいて Products テーブルをランク付けし、daystomanufacture でグループ化します。上記の情報を使用して、SQL を作成し、ランキングが同じであるがランクの数値にギャップがないような定価を表示します。

これは私が持っているコードです。

USE AdventureWorks2008R2;
SELECT Dense_Rank () OVER (PARTITION BY a.ProductID ORDER BY a.ListPrice) AS 'Ranking',
a.ProductID, b.Name, b.DaysToManufacture, a.ListPrice
FROM Production.ProductListPriceHistory a 
INNER JOIN Production.Product b
ON a.ProductID= b. ProductID
WHERE MakeFlag = 1
ORDER BY Ranking;

これは機能しますが、リスト価格の一部がグループ化されていません。ON ステートメントを a.ListPrice = b.ListPrice にする必要がありますか?

4

0 に答える 0