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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:33:21+00:00 2026-06-01T01:33:21+00:00

I am working on to build a query in MYSQL by which I can

  • 0

I am working on to build a query in MYSQL by which I can search through firstName and lastName columns in table that can return all records that nearly matches it.

Like I want to search a name say, Aditya Kumar Sharma and my table containes something like this:

ID    firstName        lastName
1     Jack             Mathews
2     Aditya           Singh
3     James            Hopes
4     Aditya Kumar     Sharma
5     Adityahappy      Singh

Now I want all the records containing any of these Aditya or Kumar or Sharma in both firstName and lastName columns, which means I need following records in my resultset:

ID    firstName        lastName
2     Aditya           Singh
4     Aditya Kumar     Sharma
5     Adityahappy      Singh

Can anyone provide me some clue, how to get it done. and it will be more pleasing if the most matching record comes on top, that is:

ID    firstName        lastName
4     Aditya Kumar     Sharma

comes on top of resultset, as it is completely matching the query String.

EDIT : I am using InnoDB engine for my database so FullText do not work over that, is there any other way around or I am forced to switch my DB engine?

  • 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-01T01:33:22+00:00Added an answer on June 1, 2026 at 1:33 am

    I think FULLTEXT search will work

    SELECT *, 
         MATCH ( `FirstName`, `Lastname`) 
         AGAINST ('+name +middle_name +lastname' IN BOOLEAN MODE) as `rel`
    FROM `table` 
    WHERE MATCH ( `FirstName`, `Lastname`) 
         AGAINST ('+name +middle_name +lastname' IN BOOLEAN MODE)
    ORDER BY `rel` DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue working with Microsoft.Build.BuildEngine which supposed to get fixed modifing my
Working on some tweaks for a build script, I noticed that the output from
I've been working on a comprehensive build system that performs distributed builds on multiple
I'm working with an application that has a MySQL database at Amazon RDS. The
I am working on a web application, which historically was built on a PHP/MySQL
I'm working to build a module in Pligg CMS which would limit a user
I have job insert page which is working fine. I just build an update
I'm attempting to construct a search query in MySQL using multiple arguments, and I
I'm working on a search function to take user input and search a mysql
I'm working to build a jQuery AutoSuggest plugin, inspired by Apple's spotlight. Here is

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.