cancel
Showing results for 
Search instead for 
Did you mean: 

Formula to select first record on the column

Former Member
0 Kudos

Hi All

I need a formula to select a first record on the column, here is my query

SELECT DISTINCT 
                      dbo.OWOR.DocNum, dbo.OWOR.ItemCode, dbo.OWOR.Status, dbo.OWOR.PlannedQty, dbo.ITM1.Price, dbo.OWOR.Warehouse, 
                      dbo.OWOR.PlannedQty * dbo.ITM1.Price AS Total
FROM         dbo.OWOR INNER JOIN
                      dbo.ITM1 ON dbo.OWOR.ItemCode = dbo.ITM1.ItemCode
WHERE     (dbo.OWOR.Status = 'P') OR
                      (dbo.OWOR.Status = 'R') AND dbo.ITM1.Price

I need to select the first price on the price list for (dbo.ITM1.Price).

Regards

Bongani

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Bongani,

Are you sure you don't want to link a pricelist? Because the unique key on ITM1 consists of ItemCode and PriceList and taking the first price for an item in ITM1 could result in kind of random prices for different items, depending on whice pricelist gets filled first for a certain item.