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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:50:42+00:00 2026-06-10T13:50:42+00:00

I have a very large table (few million records). The columns in the table

  • 0

I have a very large table (few million records). The columns in the table say A are currently like this:
id, road name, lat, lon where id is an auto increment PK.

Currently 1 road name can have multiple entries in the table as each road is mapped to a number of (lat, lon) combination.

What I’m trying to do is make road name as primary key and then remove lat and lon columns. Then add a column of type Geometry which will contain a list of (lat – lon) points that represent the road.

I can easily do this in java + mysql, but what I was wondering was if there is a way to easily do this by writing couple of nested queries? Basically I already have a populated table A and another table B with just road name as PK and a second column of type Geometry. What I want is combine all the lat, lon for each unique road name to a Geometry Point list and insert to table B. Is it possible to do this in mysql?

Note: Don’t worry about uniqueness of road names as this is just an example and not the actual scenario. Thanks!

Update: The concat/group_concat function returns a String. As my column type is Geometry, I just pass this string to GeomFromText() spatial function in MySQL Spatial Extension to get in geometry format.

  • 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-10T13:50:44+00:00Added an answer on June 10, 2026 at 1:50 pm

    I think the following query will do what you want:

    select RoadName,
           group_concat(RoadPoint order by id separator ',') as geometry
    from (select A.*,
                 concat('(', lat, ',', long, ')') as RoadPoint
          from A
         ) t
    group by RoadName
    

    This will produce the list as comma-separated sublists, in the order the points appear in A.

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

Sidebar

Related Questions

I have a very large table (15 million rows, this is an audit table).
I have a very large table of over 9 million rows and in my
Let's say I have a very large MySQL table with a timestamp field. So
I have a very large table (millions of records) containing approximately 8 fields as
I have a very large table (5mm records). I'm trying to obfuscate the table's
I have a very large table called paypal_ipn_orders . In this table I have
I have a very large table (more than 10M or even 100M records) with
I have a very large UIView approx 3000x3000 in size. In this large view
I have a very large XML file which has like 40000 data, and when
I have a very large table with an indexed datetime field. I want to

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.