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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:54:10+00:00 2026-06-13T03:54:10+00:00

As I mention in the title, I’m doing a request for latitude and longitude

  • 0

As I mention in the title, I’m doing a request for latitude and longitude within a ‘bid_userloc’ table … but I need to combine information from the ‘wp_usermeta’ table …

SET @centerLat = '48.531157';
SET @centerLng = '-123.782959';

SELECT *, ( 3959 * acos( cos( radians( @centerLat ) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(@centerLng) ) + sin( radians( @centerLat ) ) * sin( radians( lat ) ) ) ) AS distance FROM bid_userloc HAVING distance < 25 ORDER BY distance LIMIT 0 , 20

And using the user_id that comes in from the SELECT *, I need to get some user data from the wp_userdata table that looks like this:

id
meta_key
meta_value

For example, I need the meta_value of meta_key “nickname” … as well as a number of others, but once I see how it’s done for one, I can add more.

I really appreciate it!

  • 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-13T03:54:12+00:00Added an answer on June 13, 2026 at 3:54 am

    Try this, with distance replaced with what you originally had, and something else replaced with something real:

    SET @centerLat = '48.531157';
    SET @centerLng = '-123.782959';
    
    SELECT bid_userloc.*, distance, nickname.meta_value, something_else.meta_value
    FROM bid_userloc
    LEFT JOIN wp_usermeta AS nickname 
        ON nickname.userid = bid_userloc.user_id 
            AND nickname.meta_key = 'nickname'
    LEFT JOIN wp_usermeta AS something_else 
        ON something_else.userid = bid_userloc.user_id 
            AND something_else.meta_key = 'something_else'
    HAVING distance < 25
    ORDER BY distance 
    LIMIT 0 , 20
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Should I mention [request setHTTPMethod:@GET] ? and what should I enter in the [request
The Java tutorials here mention that &= is an assignment operator but doesn't seem
LATER EDIT: Please mention not only game programming books, but also more scientific/simulation oriented
I used to implement this above title by using iframe but now I dont
Basically, what the title says. I have several properties that combine together to really
As I mention in the title, I'm interested to know what you (as experienced
As the title says , I need to find two specific words in a
As the title indicates, I would like to do the following, but the compiler
How can I set title of the context menu from the selected Listview item?
The title says everything. I need to make selecting of the UITableViewCells possible when

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.