From: | "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com> |
---|---|
To: | Tom Rochester <tomr(at)chu(dot)com(dot)au> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: substr_count |
Date: | 2003-07-10 15:36:50 |
Message-ID: | Pine.LNX.4.33.0307100936220.10734-100000@css120.ihs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, 10 Jul 2003, Tom Rochester wrote:
> Hey all,
>
> I would like to achive something along the lines of:
>
> SELECT field FROM table WHERE field ILIKE '$searchterm' ORDER BY
> substr_count(field, '$searchterm');
>
> Of course the substr_count function does not exist. Is there anyway to
> do this?
>
> I had a thought char_count(replace(field, !$searchterm, '')) might do
> the job but replace doesn't allow for 'replace everything NOT string';
You'll likely have to code a bit in pl/pgsql. The regex capable substring
of 7.3 might come in handy.
From | Date | Subject | |
---|---|---|---|
Next Message | scott.marlowe | 2003-07-10 15:47:57 | Re: trigger proceedures in sql |
Previous Message | scott.marlowe | 2003-07-10 15:24:39 | Re: max length of sql select statement ? |