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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:48:56+00:00 2026-05-25T17:48:56+00:00

I want to create a query where I can compare all columns in a

  • 0

I want to create a query where I can compare all columns in a table with my text and get the results. Something like this,

 $query="SELECT * FROM table_name WHERE `column1` LIKE '%text%', `column2`LIKE '%text%', `column3` LIKE '%text%' ......`columnN` LIKE '%text%'

Helps are appreciated.

  • 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-25T17:48:57+00:00Added an answer on May 25, 2026 at 5:48 pm

    You can use a FULLTEXT index:

    CREATE FULLTEXT INDEX ON table_name (column1, column2, column3, ... columnN);
    
    SELECT * FROM table_name 
    WHERE MATCH(column1, column2, column3, ... columnN) AGAINST ('text')
    

    This is not only easier to code, but it can run hundreds of times faster than using wildcard patterns LIKE '%text%'.

    Note you must list the same columns in your MATCH() clause as the columns you specified for the index.

    Another suggestion: if the multiple columns (column1, etc.) are really multiple values for the same type of thing, you should put them in a child table.


    Re your questions about getting errors:

    My apologies, my example above was incomplete. CREATE INDEX requires that you give the index a name. For example:

    CREATE FULLTEXT INDEX ftbeer ON beer (beer, brewery, style, type, aroma, 
      taste, strength, appearance, origin, rating, price, description);
    

    Also if you use back-ticks, be careful to use them properly, to delimit table names or column names. You seem to have imbalanced back-ticks.

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

Sidebar

Related Questions

I want to create group query where Table values are like this below: EMP_ID
i want to create query like this using lambda expression in ObjectQuery SELECT *
I want DBSession.query(Article).group_by(Article.created.month).all() But this query can't using How do I do this using
I want to make this kind of query: create procedure something @name varchar(13) as
I want to create a function that has a select query inside that can
I want to create this query: select * from products where number in ('123',
we want to create MS-Access LIKE query parser where user can create complex queries
Can anyonen help with Teradata? I want to create a query that is a
Data table structure is: id1,id2,id3,id4,... (some other fields). I want to create summary query
As i previously discovered, SQLieParameter (parametrized query) can't be used for create table in

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.