Skip to Content
author's profile photo Former Member
Former Member

Formula to select first record on the column

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2010 at 01:50 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.