| From: | "Emils Klotins" <emils(at)mail(dot)usis(dot)bkc(dot)lv> |
|---|---|
| To: | Michal Samek <webmaster(at)tony(dot)cz> |
| Cc: | <pgsql-sql(at)postgreSQL(dot)org> |
| Subject: | Re: [SQL] Select like when searching for whole word and optimizing it -- regexp? |
| Date: | 1999-06-10 11:41:17 |
| Message-ID: | 199906100837.LAA02976@omega.bkc.lv |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
[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(at)mail(dot)usis(dot)bkc(dot)lv
Systems Manager URL: http://www.usis.bkc.lv/
USIS Riga 7 Smilsu Str., Riga LV1050, LATVIA
| From | Date | Subject | |
|---|---|---|---|
| Next Message | José Soares | 1999-06-10 12:13:48 | Re: [SQL] DataStyle |
| Previous Message | Remigiusz Sokolowski | 1999-06-10 09:57:10 | DataStyle |