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

  • Home
  • SEARCH
  • 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 7710421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:07:19+00:00 2026-06-01T01:07:19+00:00

Lets say I have table named Place with columns: placeId int not null auto_increment,

  • 0

Lets say I have table named Place with columns:

placeId int not null auto_increment,
latitude double,
longitude double,

Doesn’t exacly matter what columns they are, just get an idea.

Now lets say I receive somehow latitude and longitude of a point, what I’m trying to achive is select from table Place row, which GLength value is the smallest.

Its easy when I do something like this in mysql:

SET @ls = 'LineString(50.123 23.321,51.567 23.123)';
SELECT GLength(GeomFromText(@ls));

But generally I have no idea how could I make such query with variables (I’m poor at mysql) any help?

I’d use order by GLength(..) and limit result to 1, but how can I make such iteration?

My goal is to fire code via Java and Hibernate as native sql 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-01T01:07:20+00:00Added an answer on June 1, 2026 at 1:07 am

    OK, made it with my teammate, if anyone wants it, here’s the select:

    SELECT GLength(
        linestringfromwkb(
        LineString(
            GeomFromWKB(Point(j.latitude,j.longitude))
        ,GeomFromWKB(Point(51,22))))),j.latitude,j.longitude FROM my_database.place_table j 
    order by 
    GLength(
        linestringfromwkb(
        LineString(
            GeomFromWKB(Point(j.latitude,j.longitude))
        ,GeomFromWKB(Point(51,22))))) asc
    limit 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a table with columns such as: ID Name City State
Lets say I have a table named my_table with primary_key table_pk and with three
For the sake of simplicity lets say I have a table with 3 columns;
Lets say I have an Areas Table ( id, parentId, name, path ). Given
Lets say we have a table Names: ID Name Surname 1 Matt Smith 2
Let's say I have a table named products and I want to know how
i am working with MsSql server 2008, lets say i have table invoices contains
Lets say we have two databases, one named db1, the other one named db2.
Alright, so let's say I have a database with a table named COMPANY_PARAMETERS that
Let's say I have a table named transaction with transaction_date, deposit, withdrawal fields. There

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.