RE: Regexp matching in SQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
I am trying to simplify an SQL query that is pretty much like below:

$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression1' OR 
keyword RLIKE '$expression2' ";

The different terms '$expression1' and '$expression1' come from  an
array.

Is there any way to within one regular expression to say either term1 or

term 2? Something like this where the OR condition would be basically 
built into the regular expression:

$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression'";   // the

$expression would have to signify either a or b.

Does that make sense?

[/snip]

Kinda'. If you asked on a SQL board they would say do this;

SELECT * FROM table WHERE keyword IN ($expression1, $expression2)

IN is the shorthand for multiple OR conditions.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux