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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:35:42+00:00 2026-05-11T22:35:42+00:00

I have 3 tables event, location, event_location. Event can have multiple locations. Location table

  • 0

I have 3 tables event, location, event_location. Event can have multiple locations.
Location table has lattitude, longitude, hasGeocode fields.

so for keywords “hello world”

a simple query to Event table becomes

Select * from event where keywords like '%hello%' OR keywords like '%world%'

but if if the user has entered their location then I want to include location table in this query as well, so that users can specify their choice of location, how do i do this?

so essentially 3 types of search queries

  • just keywords

  • keywords and location

  • keywords, proximity and a location

I tried something like this –

   select * from event where keywords like '%hello%' OR
   keywords like '%world%' INNER JOIN location ON 
   location.location_id = event_location.location_id 
   INNER JOIN 
   event_location ON event_location.event_id = event.event_id

INNER JOINs mean event has to have one or more locations. If an event hasnt got any location it wont appear in search results. So please help me, how do I do this?

Thanks for you help.

  • 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-11T22:35:43+00:00Added an answer on May 11, 2026 at 10:35 pm

    You’ve got your join syntax all mangled up. In any case, if inner joins are not cutting it, use outer joins. 😉

    SELECT
      *
    FROM
      event AS e
      LEFT JOIN event_location AS el ON el.event_id = e.event_id
      LEFT JOIN location       AS  l ON l.location_id = el.location_id
    WHERE
      e.keywords LIKE '%hello%' 
      OR e.keywords LIKE '%world%' 
    

    Also, the use of table aliases is never a bad idea, especially if your table names are long.

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

Sidebar

Related Questions

I have 2 tables event + event_artist event eventId | eventName ------------------- 1 ,
I have an Oracle table which contains event log messages for an application. We
In my database I have tables that define types for example Table: Publication Types
Suppose you have the tables Presentations and Events . When a presentation is saved
I have a table of events with a recorded start and end time as
I have a table of events, I need to find all tail events of
I have an Events table whose goal is to store actions done by web
When I have tables in my database that have PK/FK relationships (int) and when
Using MS Access 2007, I am creating a student management database. I have tables
I have several tables whose only unique data is a uniqueidentifier (a Guid) column.

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.