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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:05:18+00:00 2026-05-28T04:05:18+00:00

I have a table with columns latitude and longitude. In most cases the value

  • 0

I have a table with columns latitude and longitude. In most cases the value extends past the decimal quite a bit: -81.7770051972473 on the rare occasion the value is like this: -81.77 for some records.

How do I find duplicates and remove one of the duplicates for only the records that extend beyond two decimal places?

  • 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-28T04:05:18+00:00Added an answer on May 28, 2026 at 4:05 am

    Using some creative substring, float, and charindex logic, I came up with this:

    delete l1
    from 
        latlong l1
        inner join (
            select
                id,
                substring(cast(latitude as varchar), 0, INSTR(CAST(latitude as varchar))+3, '.') as truncatedLat
            from
                latlong
        ) l2 on
            l1.id <> l2.id
            and l1.latitude = cast(l2.truncatedLat as float)
    

    Before running, try select * in lieu of delete l1 first to make sure you’re deleting the right rows.

    I should note that this worked on SQL Server using functions I know exist in MySQL, but I wasn’t able to test it against a MySQL instance, so there may be some little tweaking that needs to be done. For example, in SQL Server, I used charindex instead of instr, but both should work similarly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have latitude and longitude columns in location table in PostgreSQL database, and I
I have a table with two columns: latitude and longitude. I want to get
Group, I have table columns ProductID, latitude,longitude,timestampGMT and looking for a query to count
I have a table with columns 'id', 'name', 'value', 'uniqueConst' in both databases. Now
I have a SQLite database in Android with a table that contains longitude, latitude
I have a table containing latitude and longitude values stored as strings ( VARCHAR
I have a data table in my SQLite database with information about longitude, latitude
The table columns have the data type BLOB and CLOB. What are the corresponding
I have table with 3 columns A B C. I want to select *
I have table with two columns (startdate & enddate) and I have two submission

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.