www.webdeveloper.com
Results 1 to 2 of 2

Thread: Find records according to a list of words

  1. #1
    Join Date
    Jan 2013
    Posts
    84

    Question Find records according to a list of words

    Accoring to a string that contain words separated from a space, in mySql i need to search all records in which the title contains at least one those words.
    There are a specific syntax for do that, or i've to generate a WHERE IN (word1, word2, word3...) clause?
    And there are a solution basend on the LIKE clause?

    Searching on internet i found this solution too
    PHP Code:
    WHERE interests REGEXP 'sports|pub' 
    is that the better?

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,604
    Probably the best solution in terms of performance and functionality would be to set a FULLTEXT index on the column and use the related fulltext search functions.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles