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

Show Last Price of a Customer for each item they even bought from ORDR

Basically, i would like to draw latest price of each item that i sold to this customer

This query works well with my formatted search, when i convert into a query it doesn't works, the query as below


SELECT ItemCode ,DocDate, Dscription, FrgnName,Available, Price

FROM (

SELECT T1.ItemCode ,T1.Dscription, T2.frgnName,T2.OnHand-T2.IsCommited as 'Available',T0.DocDate , T1.Price,

Rank() over (Partition BY T1.ItemCode ORDER BY T0.DocDate DESC ) AS Rank

FROM OINV T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry

INNER JOIN OITM T2 ON T1.itemcode = T2.itemcode

WHERE T0.Cardcode = [%0]

) rs WHERE Rank <= 1

Thank you to anyone out there can help

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jun 05, 2014 at 03:42 AM

    Hi,

    Try this:

    SELECT ItemCode ,DocDate, Dscription, FrgnName,Available, Price

    FROM (

    SELECT T1.ItemCode ,T1.Dscription, T2.frgnName,T2.OnHand-T2.IsCommited as 'Available',T0.DocDate , T1.Price,

    Rank() over (Partition BY T1.ItemCode ORDER BY T0.DocDate DESC ) AS Rank

    FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry

    INNER JOIN OITM T2 ON T1.itemcode = T2.itemcode

    WHERE T0.Cardcode = [%0]

    ) rs WHERE Rank <= 1

    Thanks & Regards,

    Nagarajan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 05, 2014 at 03:45 AM

    Hi,

    Have you checked the option of 'Last Prices' which is available when you right click on a row?

    Thanks,

    Joseph

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 05, 2014 at 04:52 AM

    Hello

    Try this

    Thanks & Reagrds

    Pankaj Jha


    abc.jpg (130.8 kB)
    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.