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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:33:38+00:00 2026-06-16T17:33:38+00:00

I have developed a system using an OR query: SELECT * FROM tableA JOIN

  • 0

I have developed a system using an OR query:

SELECT * FROM tableA 
JOIN tableB ON (idA = idB)
WHERE idA = 1 OR 
      idA = 2 OR 
      idA = 3 OR 
      idA = 4 OR 
      idA = 5 ...... OR 
      idA=100

Compare with query IN:

SELECT * 
FROM tableA JOIN tableB ON (idA = idB)
WHERE idA IN (1,2,3,4,5,......,100)

What is the best query in a MYSQL database?

  • 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-16T17:33:39+00:00Added an answer on June 16, 2026 at 5:33 pm

    Use IN.

    IN will use an index.

    OR will (afaik) not use an index.

    Also, and this point is not to be sneezed at, the IN version:

    • uses less code
    • is easier to maintain
    • is easier to understand

    For those reasons alone I would be prepared suffer a little performance to gain code quality, but you actually gain performance too.

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

Sidebar

Related Questions

We have an intranet system developed using asp.net webforms. We are kind of planning
I have a existing query in the system which is a simple select query
I have developed push notification system in android using c2dm, It's working fine but
I have developed a system for a client using ASP.Net MVC 3 and Entity
On a system I have developed It requires me to login using a standard
I have developed a system app for my rom which includes some native libraries.
I have developed a communication system in PHP. It would be amazing if users
I have developed a small download system in PHP, where files are downloaded through
i have developed a web servcies in my local system with name (inbox service).
I have developed a project (employee management system), now I am on reporting part.

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.