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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:50:43+00:00 2026-05-25T01:50:43+00:00

I have a database of activities , each activities could be held on 3

  • 0

I have a database of activities , each activities could be held on 3 days , each day contains a postal code .

So the database looks like that (+ alot of other fields)

enter image description here

In another database i have a Geo Location info (postal code , lat , long)

enter image description here

Now users can enter there postal code and a radius and activities in that radius will appear.

Question :

1 – What is the best way to accomplish that ?

Solution in mind

Make a view of all possible postal codes from the activities and join it on the Geo table to get their Lat/Lng

then when a user search for a postal code , get the Lat/Lng and do the mathematical equation to get all postal codes near that point .

But i don’t think in term of performance this is a good way since i will have to apply the query on 3000+ activities

Codes found for distance

  • Finding locations nearby with MySQL (Haversine Formula)

    SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) – radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance
    FROM markers
    HAVING distance < 25
    ORDER BY distance LIMIT 0 , 20;

What do you guys think ?

  • 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-25T01:50:44+00:00Added an answer on May 25, 2026 at 1:50 am

    I was wrong in term of performance , the query took less than 0,5 second to calculate the distance on the 3000+ activities .

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

Sidebar

Related Questions

I have a database that will store events. Each event has different activities. The
I have a database that contains a date and we are using the MaskedEditExtender
I have few activities that make use of sqlite database, there is use of
I have Database with date field. I see the time like: 1900-01-01 13:38:00.000 How
i have database table like this +-------+--------------+----------+ | id | ip | date |
I have a web app that contains an activity log for actions the users
I am using a database that I need to access in all activities. So
I have a database that hosts a couple of tables inside a Drupal install.
I have 2 activities. Activity A and Activity B. Both calling each other though
I have an activity that has two tabs and a list view in each.

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.