|
Posted by Rik on 06/24/06 16:50
Mark D. Smith wrote:
> Hi
>
> i want to only do a REGEXP against 4 columns in a table
>
> Job_Title | Job_Description | Job_Salary | Job_Location
>
> i tried $sql = "SELECT * FROM Jobs WHERE (Job_Title, Job_Description,
> Job_Salary, Job_Location) REGEXP '$search'"
>
> but its not a valid SQL statement. also tried with WHERE (Job_Title OR
> Job_Description OR Job_Salary OR Job_Location)
What regex, what does it need to validate?
Maybe:
SELECT * FROM Jobs WHERE CONCAT(Job_Title, Job_Description, Job_Salary,
Job_Location) REGEXP '$search'
or
SELECT * FROM Jobs WHERE Job_Title REGEXP '$search' OR Job_Description
REGEXP '$search' OR Job_Salary REGEXP '$search' OR Job_Location REGEXP
'$search'
Depending on your exact needs. What are you trying to acconbmplish, what
data is in the columns, what is in the regex?
Grtz,
--
Rik Wasmus
[Back to original message]
|