Find a string within a field
This may be easy but I am new to this so here it goes. I am trying to find if a string can be found in a mysql database field.
The following will only find exactly match
<CFQUERY DATASOURCE="databasename">
SELECT mycontact, userid
FROM mytable
WHERE email = #form.email#'
</CFQUERY>
The following will return result if the field email is contain in the form.email
<CFQUERY DATASOURCE="databasename">
SELECT mycontact, userid
FROM mytable
WHERE email like '%#form.email#%'
</CFQUERY>
But these will not give what I want. I want the reverse of the above. The email fied can contain MORE than one email addresses. I want to be able to enter a value i.e. form.email and search the table and find any record in the "email" field that contain form.emal. Help is appreciated. I am using MYSQL database. Thanks.
