Hi all !!

This is just great ! Sometimes things seem to be
more complicated than they actually are.
I needed (and still do) a similar solution to check
if an IP adress exist in a table. And sometimes the
argument in the query is a whole subnet like 192.168.0.%

I guess this will do the job for me :-)
Thanx !!!

=d0Mi=

| Hi,
| 
| > Now  I need a query which will take the values from column
| > 'query',  treat  them  as patterns for matching and return
| > row(s)  which  match  the given string 'blahblah'. In this
| > example,  the  matched  data  is  obviously in second row.
| > (bla% matches blahblah)
| 
| > Do I make any sense? Is this possible?
| > Any help will be greatly appreciated.
| 
| To  be  honest I didn't belive it would work, but... here it
| is :)
| 
| mysql> select * from blah;
| +------+----------+-------+
| | uid  | username | query |
| +------+----------+-------+
| |    1 | someuser | %qu1% |
| |    2 | anotheru | bla%  |
| +------+----------+-------+
| 2 rows in set (0.00 sec)
| 
| mysql> select * from blah where 'blahblah' like query;
| +------+----------+-------+
| | uid  | username | query |
| +------+----------+-------+
| |    2 | anotheru | bla%  |
| +------+----------+-------+
| 1 row in set (0.00 sec)
|
| Regards,
| Sasa
| 
| »mysql, select, database«


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to