On Thu, 2001-11-29 at 14:59, Zozulak Peter wrote: > and what about this ... > > $sql = "SELECT a_column FROM table WHERE text_column LIKE '% $word %'; > > matching the word in the text ... > > $sql = "SELECT a_column FROM table WHERE text_column LIKE '$word %'; > > matching the word at the begining of the text ... > > $sql = "SELECT a_column FROM table WHERE text_column LIKE '% $word'; > > matching the word at the end of the text ...
3 selects against one, well depends what the user wants and how he
values code optimizing (versus executing optimizing) this might be
somewhat better approach:
SELECT stringvar FROM tablename WHERE FIND_IN_SET('BINGO',REPLACE(UCASE(stringvar),'
',',')) > 0;
So like, first string is converted to uppercase, then all spaces are
made to colons, and then function find_in_set uses word "BINGO" to
locate if the textfield actually containts that word. Should be quite
exact match allthou i dont guarantee it to work (didnt test it, should
work thou)
Example:
"I want to BinGo, would you want to come ?" -> would translate to
"I WANT TO BINGO, WOULD YOU WANT TO COME ?" -> would translate to
"I,WANT,TO,,,BINGO,,WOULD,YOU,WANT,TO,COME,?"
And result for find_in_set for this string would be 6 so it would
match..
--
| ,_, Jani Mikkonen, bofh and proud of it, +358456700349
|(O,O) http://www.mikkonen.org/jani
|( ) Pgp public key @ http://www.mikkonen.org/jani/keyh.html
+-"-"-------] And i repeat, I do not make mistakes that count.
|
msg41402/pgp00000.pgp
Description: PGP signature

