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 6835143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:11:50+00:00 2026-05-26T23:11:50+00:00

MY Table is id position some data —|——–|————| 1 | 1 | data |

  • 0

MY Table is

id  position  some data   
---|--------|------------|
1  | 1      | data       | 
1  | 2      | data       | 
2  | 1      | data       | 
2  | 2      | data       | 
5  | 1      | data       | 
5  | 2      | data       |
5  | 3      | data       | 

how do i format it into the following. so that it shows only the unique ID with the highest position as following. The data is a longitude and latitude, so it should only return the highest position long and lat.

id  position  some data   
---|--------|------------|
1  | 2      | data       | 
2  | 2      | data       | 
5  | 3      | data       | 
  • 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-05-26T23:11:50+00:00Added an answer on May 26, 2026 at 11:11 pm

    You can join on a maximum-grouped set;

    select *
    from the_table inner join (
        select id, max(position) as max_pos
        from the_table
        group by id
        ) as T on the_table.id = T.id and the_table.position = T.max_pos
     order by the_table.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following code to get some data from a table. $collection =
I have a table view that has embedded UITextFields for entering some data. It
I am learning cakePHP 1.26. I got some sample data in a Table Testing
I have a table with some customer data. I am using jquery hover to
Updated I have some huge data, which becomes a large table say table parent
I have a silverlight 3 application, that fetches some simple data from a ms-sql-server
Input: The customer claims that the application (.NET) when querying for some data returns
here is my below xml under that table due based on CTD_CTD_PKG_ID(some time under
I have an HTML table in which each data row has a unique id
I am trying to insert some data into the database if the app is

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.