Subject Re: FIRST 1 of each iItemID
Author
Hi Mark

I have updated the original post with the new cID column values

I have a view and the following query which returns multiple records from the view (see below) for each iItemID


SELECT iItemID
        , cID
        , bRate
   FROM vwPriceListHistory
   ORDER by iItemID, cID DESC

What I want is one first record of each iItemID (ie. the latest price).  I have tried various combination of GROUP BY and FIRST 1 but I do not get the correct result, I just want:


iItemID, cID, bRate

35    201405135940      0         1825              34.740000

36    2015052513821     0         1825              46.140000

37    2017071522277     0         1880              2000.000000


Please advise


Kind regards

Bhavbhuti


iItemID, cID, bRate

35    201405135940      0         1825              34.740000
35    201404109498      0         388               43.231400
35    19000101                    0                 0.000000
36    2015052513821     0         1825              46.140000
36    2015052313816     0         1825              34.740000
36    2015051411442     0         1825              46.140000
36    2015051411441     0         1825              0.000000
36    201405135938      0         1825              46.140000
36    19000101                    0                 0.000000
37    2017071522277     0         1880              2000.000000
37    2017071522272     0         1880              200.000000
37    2017071122263     0         3263              434.000000
37    2016091718970     0         367               176.090000
37    2016052415723     0         367               176.000000
37    2016041715289     0         365               176.090000
37    2016041015232     0         2754              176.090000
37    2016020415103     0         365               251.500000
37    2015052113761     0         479               20.290000
37    2014100210133     0         365               176.090000
37    201308092879      0         481               216.580000
37    201304092645      0         365               163.050000
37    19000101                    0                 0.000000