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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:21:24+00:00 2026-05-15T05:21:24+00:00

The table’s schema is pretty simple. I have a child table that stores a

  • 0

The table’s schema is pretty simple. I have a child table that stores a customer’s information like address and phone number. The columns are user_id, fieldname, fieldvalue and fieldname. So each row will hold one item like phone number, address or email. This is to allow an unlimited number of each type of information for each customer.

The people on the phones need to look up these customers quickly as they call into our call center. I have experimented with using LIKE% and I’m working with a FULLTEXT index now. My queries work, but I want to make them more useful because if someone searches for a telephone area code like 805 that will bring up many people, and then they add the name Bill to narrow it down, ‘805 Bill’. It will show EVERY customer that has 805 OR Bill. I want it to do AND searches across multiple rows within each customer.

Currently I’m using the query below to grab the user_ids and later I do another query to fetch all the details for each user to build their complete record.

SELECT DISTINCT `user_id` FROM `user_details` WHERE MATCH (`fieldvalue`) AGAINST ('805 Bill')

Again, I want to do the above query against groups of rows that belong to a single user, but those users have to match the search keywords. What should I do?

  • 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-15T05:21:25+00:00Added an answer on May 15, 2026 at 5:21 am

    Have you tried using BOOLEAN MODE search queries?

    SELECT `user_id` FROM `user_details` 
    WHERE MATCH (`fieldvalue`) AGAINST ('+805 +Bill' IN BOOLEAN MODE)
    

    It means you have to manipulate the search query that is entered by the user. You can’t just pass it into your query verbatim; you have to add + characters and so on.


    Re your comment: Any SQL predicate evaluates in the context of only one row at a time. The way to compare rows is to use a self-join:

    SELECT `user_id` FROM `user_details` u1 JOIN `user_details` u2 USING (`user_id`)
    WHERE MATCH (u1.`fieldvalue`) AGAINST ('805 Bill' IN BOOLEAN MODE)
      AND MATCH (u2.`fieldvalue`) AGAINST ('805 Bill' IN BOOLEAN MODE)
    

    PS: I removed DISTINCT because it’s a no-op in this query and can only reduce performance.

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

Sidebar

Related Questions

Table schema is set up something like this: userID Points timestamp 1 40 3
I have a script that appends some rows to a table. One of the
The table doesn't have a last updated field and I need to know when
My table structure looks like this: tbl.users tbl.issues +--------+-----------+ +---------+------------+-----------+ | userid | real_name
A table exists that someone else loaded. I need to query against the table,
Table items keeps track of the different types of items that can be stocked.
table structure: sysdurationtimeday , sysdurationtimehour, sysdurationtimeminute 1, 12,10 3, 23,10 0, 0,10 i have
I have a project that adds elements to an AutoCad drawing. I noticed that
table ab: partyid conatctpurpose 1 general 1 shipping 1 phone 1 fax 2 general
Table: Customer with columns Start_Time and End_Time. I need to add a new column

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.