Match exact match partial phrase SQL
Posted on 2004-11-11
i want to do the following
Enter Phrase |___________________| o Match Exact
i have a textbox and a checkbox on a webpage, i want to the user to be a able to enter a search a description field in a database table,
if they enter 'redhat linux', and dont click match exact, i want rows to be returned if eiter 'redhat' or 'linux' or 'redhat linux' appear in the description field, and if they check the match exact field then only rows with 'redhat linux' should be returned,
is there an easy way to do this in sql, or do i have to split the search string then do seperate searches, then combine the search results then remove duplicate rows??
also if i do this 'WHERE description LIKE %linux%' will this bring back records where linux is the first word in the description, or would i have to do seperate sql searchs for %linux%, linux%, and %linux,