Received: from omega.bkc.lv (omega.bkc.lv [195.244.128.2]) by hub.org (8.9.3/8.9.3) with ESMTP id EAA87115 for ; Thu, 10 Jun 1999 04:37:23 -0400 (EDT) (envelope-from emils@mail.usis.bkc.lv) Received: from mail.usis.bkc.lv (mail.usis.bkc.lv [195.244.132.2]) by omega.bkc.lv (8.9.1/8.9.1) with ESMTP id LAA02976; Thu, 10 Jun 1999 11:37:06 +0300 (EEDT) Message-Id: <199906100837.LAA02976@omega.bkc.lv> Received: from USIS-RIGA/SpoolDir by mail.usis.bkc.lv (Mercury 1.44); 10 Jun 99 11:41:52 EET Received: from SpoolDir by USIS-RIGA (Mercury 1.44); 10 Jun 99 11:41:28 EET From: "Emils Klotins" Organization: USIS Riga To: Michal Samek Date: Thu, 10 Jun 1999 11:41:17 EET MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: [SQL] Select like when searching for whole word and optimizing it -- regexp? Reply-to: emils@mail.usis.bkc.lv CC: Priority: normal In-reply-to: <375E289E.EF906BD2@tony.cz> X-mailer: Pegasus Mail for Win32 (v3.02b14) [9 Jun 99,, 10:41] Michal Samek wrote: > In my e-shop I'm using the searching based on select like command; > something like > SELECT * FROM kat WHERE name LIKE '%some_text%'; > and when searching for the whole word: > SELECT * FROM kat WHERE name LIKE '% some_text %'; > For this is necessary to maintain the name column with one space added > before and after the name column value (to match starting and ending > words). It's working but very ugly. > > Maybe there is some better way to search for the whole word? Try regexp searching. Don't know if available at 6.4, but definitely is there at 6.5 SELECT * FROM kat WHERE name ~* ' your regexp '; Emils Klotins e-mail: emils@mail.usis.bkc.lv Systems Manager URL: http://www.usis.bkc.lv/ USIS Riga 7 Smilsu Str., Riga LV1050, LATVIA