• waheed71 (1/6/2014)


    Dear ChrisM / Dear Lowell,

    Thanks for the prompt reply. I am really sorry about not able to communicate properly. So far I am unable to get required result.

    I just need Supplier Name & Supplier Code by MAX Statement (Rather than Supplier Code only). So far using ChrisM Query, results are same like mine query.

    Could you please provide tip how to get exact name from SU_SUPPLIERNAME field which shall be equal to output from SQL MAX Function as LASTVENDOR (Which is Numeric field).

    For example if LASTVENDOR = '30-11-710' and that record belongs to General Supplier NOMAC (Description or Supplier Name of '30-11-710')

    Change the join column on my query to whichever MAX column fits your requirement.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden