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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:39:41+00:00 2026-06-09T10:39:41+00:00

I am trying to do a filter query by using the next statement: SELECT

  • 0

I am trying to do a filter query by using the next statement:

SELECT * FROM user_jobs,users WHERE user_jobs.job_title LIKE "%some_keyword%" **OR** user_jobs.job_title LIKE "%another_keyword%" AND user.id=user_jobs.userid

Specs: users.id is PK and user_jobs.userid is FK to users.id

I am trying to filter the users to get the ones that have similar values as specified. When I run it I get a very long loop and finally a large list of users that contains duplicates. (e.g. I only have 300 users and the query shows over 3000 results)

What am I doing wrong, please?

Thanks in advance!

  • 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-09T10:39:42+00:00Added an answer on June 9, 2026 at 10:39 am

    First off, the AND operator holds precedence in this case. Isolate your logic like so:

    SELECT * FROM user_jobs,users WHERE (user_jobs.job_title LIKE "%some_keyword%" OR user_jobs.job_title LIKE "%another_keyword%") AND user.id=user_jobs.userid
    

    Second of all, don’t use SELECT * FROM .... This selects all your data, adding network overhead and taking up more time to transfer it all across the server.

    Reference: https://dev.mysql.com/doc/refman/5.0/en/func-op-summary-ref.html

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

Sidebar

Related Questions

I am trying to filter results in an sql query using the like statement.
I am trying to query users by list of id using in statement http://www.w3schools.com/sql/sql_in.asp
I'm trying to filter a table from an alphabetical <select> input with jQuery. I
Greetings, I am trying to tear down query returned from find call using containable
I'm trying to filter a SELECT query between NOW() and NOW - interval 10
I am trying to select a grouped average. a1_avg = session.query(func.avg(Table_A.a1_value).label('a1_avg'))\ .filter(between(Table_A.a1_date, '2011-10-01', '2011-10-30'))\
I'm trying to fetch some records from MSSQL DB using EntityObject with EntitySQL query.
I'm trying to filter to only show Active entities while making a query, using
I am trying to use a cursor with a managed query to filter media
I am trying to filter a fusion table using the WHERE clause in order

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.