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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:06:54+00:00 2026-06-15T02:06:54+00:00

I have a search that searches for a match through several columns in multiple

  • 0

I have a search that searches for a match through several columns in multiple tables. The issue is that I am using “OR” but this does not work if the user searches multiple columns.

Here is my query:

    SELECT clients.clientName,
       projects.Client_ID,
       projects.projectNumber,
       projects.projectName,
       projects.projectManager,
       projects.expectedDate,
       projects.address,
       projects.CreationDate,
       projects.custom1,
       projects.custom2,
       projects.custom3,
       projects.custom4,
       projects.custom5,
       projects.custom6,
       projects.custom7,
       projects.custom8,
       projects.custom9,
       projects.Status_ID,
       statuses.status
FROM projects
JOIN clients ON projects.Client_ID = clients.Client_ID
JOIN statuses ON  projects.Status_ID = statuses.Status_ID
WHERE clientName LIKE '%$keyword%'
  OR projectNumber LIKE '%$keyword%'
  OR projectName LIKE '%$keyword%'
  OR address LIKE '%$keyword%'
  OR area LIKE '%$keyword%'
  OR status LIKE '%$keyword%'
  OR custom1 LIKE '%$keyword%'
  OR custom2 LIKE '%$keyword%'
  OR custom3 LIKE '%$keyword%'
  OR custom4 LIKE '%$keyword%'
  OR custom5 LIKE '%$keyword%'
  OR custom6 LIKE '%$keyword%'
  OR custom7 LIKE '%$keyword%'
  OR custom8 LIKE '%$keyword%'
  OR custom9 LIKE '%$keyword%';  

If the user searches:
a status and client –my query will not return any results.

Also, I am worried about the speed of this query with a lot of data.

  • 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-15T02:06:55+00:00Added an answer on June 15, 2026 at 2:06 am

    You’re right, the type of query you’re using will force a table-scan, and it cannot be indexed. This is still true even if you only search a single column with LIKE '%$keyword%'

    The only efficient way to do full text search is with special fulltext indexing technology. MySQL has this built in, but only for MyISAM tables currently (fulltext indexes will be supported in InnoDB in MySQL 5.6).

    You should read my presentation: Full Text Search Throwdown for a comparison of different solutions. It’s clear from the testing I did that using LIKE runs hundreds or thousands of times slower than using any type of text indexing. How much slower depends largely on the size of your table.


    Re comment from @Dagon:

    I originally did this presentation in 2008, but I updated it and re-ran all my tests in April 2012. The differences from my 2008 presentation were insignificant.

    Any indexing solution is still orders of magnitude better than the costly table-scans you get with LIKE. The larger your table, the greater the benefit of indexing. This principle is not going to change.

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

Sidebar

Related Questions

I have a search engine that searches albums. For each music album, I have
I currently have an advanced search page that searches a number of fields in
(Using MySQL and PHP) I have a search form that will allow my users
I have a simple php mysql search that searches a database, however, i cannot
I have a simple search script that takes user input and searches across directories
I have a couple of regular expressions that work fine using Emacs' interactive search.
I have a live search on my help page that searches our help database
I have a search page that if there is results in the list it
I have a search method that takes in a user-entered string, splits it at
I have a search functionality that obtains data from an InnoDB table ( utf8_spanish_ci

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.