FoolzRailer
New member
- Local time
- Today, 12:00
- Joined
- Apr 15, 2016
- Messages
- 25
Hello
I'm trying to Rank my column SKU by lowest price.
I have set up the query as described below. However for two items with the same price, it returns the wrong rank.
Example where two items have the same price, it should be ranked 1, 2 (don't care which one of the two is first). But instead it returns two 2's or other duplicate values. How can I go about getting ranks correct for same priced items?
Any help would be much appreciated!
I'm trying to Rank my column SKU by lowest price.
I have set up the query as described below. However for two items with the same price, it returns the wrong rank.
Example where two items have the same price, it should be ranked 1, 2 (don't care which one of the two is first). But instead it returns two 2's or other duplicate values. How can I go about getting ranks correct for same priced items?
Any help would be much appreciated!
Code:
SELECT PricerunnerUnionMedID.SKU AS SKU, PricerunnerUnionMedID.x_firma AS x_firma, PricerunnerUnionMedID.x_pris AS x_pris, Count(PricerunnerUnionMedID_1.SKU) AS Rang, PricerunnerUnionMedID.PricerunnerID AS PricerunnerID, PricerunnerUnionMedID.FirmaName AS FirmaName, First(PricerunnerUnionMedID.FirmanavnPris) AS FirmanavnPris
FROM PricerunnerUnionMedID AS PricerunnerUnionMedID_1 INNER JOIN PricerunnerUnionMedID ON PricerunnerUnionMedID_1.SKU = PricerunnerUnionMedID.SKU
WHERE (((PricerunnerUnionMedID_1.x_pris)<=[PricerunnerUnionMedID].[x_pris]))
GROUP BY PricerunnerUnionMedID.SKU, PricerunnerUnionMedID.x_firma, PricerunnerUnionMedID.x_pris, PricerunnerUnionMedID.PricerunnerID, PricerunnerUnionMedID.FirmaName;