Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9123145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:16:06+00:00 2026-06-17T06:16:06+00:00

I have a query with a result like this No date No.PO product type

  • 0

I have a query with a result like this

No    date           No.PO     product    type       div         price
1.      01-10-2012   |    AAA1  |     X1   |    1   |     SBS   |      100
2.      09-10-2012   |    ABA1  |     X1   |    2   |     SBS   |      150
3.      11-10-2012   |    ACC1  |     X1   |    1   |     SBS   |      110
4.      15-10-2012   |    ACD1  |     X1   |    1   |     DBS   |      115
5.      20-10-2012   |    ADA1  |     X1   |    1   |     SBS   |      112
6.      23-10-2012   |    AFA1  |     X1   |    2   |     SBS   |      160
7.      27-10-2012   |    AHA1  |     X1   |    1   |     SBS   |      120

and a few thousand record . . .

and the result should be show like this

No        date           No.PO     product    type        div         price
1.      27-10-2012   |    AHA1  |     X1   |    1   |     SBS   |       120
2.      23-10-2012   |    AFA1  |     X1   |    2   |     SBS   |       160
3.      15-10-2012   |    ACD1  |     X1   |    1   |     DBS   |       115

Here is the rules

  1. Distinct on product type and div
  2. Only the last transaction that i wanna show (it means the biggest date among the duplicate product, type and div data)
  3. All of the field (date, No.PO, product, type, div and price) must be showed

Hopefully my description is clear now . .

Anyone can help me with the right query?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:16:07+00:00Added an answer on June 17, 2026 at 6:16 am

    Please try the query and check the result, mere guess.

    SELECT * FROM(
        SELECT
            ROW_NUMBER() OVER (Partition by [Type], [Div] ORDER BY [Date] DESC) RowNum,
            [Date], 
            [No.PO], 
            [Product], 
            [Type], 
            [Div], 
            [Price] 
        FROM TABLE_Name
    )x WHERE RowNum=1 
    ORDER BY [Date] DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that creates a result set like this: Rank Name 1
I have this query which returns a result set with Date(column) as nvarchar datatype.
I have a query that produces a result like this: The data is sorted
I have query like this: SELECT DATE,REGION,COUNT(*) FROM ALL_ID_DATA WHERE DATE in (SUBDATE(CURDATE(),1),SUBDATE(CURDATE(),2),SUBDATE(CURDATE(),8)) AND
I have a query that produces a result like this: The data is sorted
I would like to retrieve an ordered query result, but I need to have
If you have a simple Linq query like: var result = from record in
I have a result from a query like the below, which does not have
I have a query with single result. The result is an anonymouse type. How
Hi I have this Query and I'm getting an empty result, Anyone see anything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.