substr_count - Mailing list pgsql-sql

From Tom Rochester
Subject substr_count
Date
Msg-id 3F0CEDC8.9000304@chu.com.au
Whole thread Raw
Responses Re: substr_count
Re: substr_count
Re: substr_count
List pgsql-sql
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';

Any Ideas?

Thanks in advance,

-- 
Tom Rochester
Systems Developer/Administrator

CHU Underwriting Agencies Pty Ltd
Level 5, 1 Northcliff Street, 
Milsons Point  NSW  2060

<P>     02 8923 5346
<F>     02 8923 5363
<M>    +61416152792
<E>     tomr@chu.com.au
<W>     http://www.chu.com.au/

"The information contained in this email and any attached files is strictly private and confidential. The intended
addresseeshould read this email only. If the recipient of this message is not the intended addressee, please call CHU
UnderwritingAgencies Pty Ltd on +61 1300 361 263 and promptly delete this email and any attachments.
 

The intended recipient of this email may only use, reproduce, disclose or distribute the information contained in this
emailand any attached files with CHU's permission. If you are not the intended addressee, you are strictly prohibited
fromusing, reproducing, disclosing or distributing the information contained in this email and any attached files.
 

CHU advises that this email and any attached files should be scanned to detect viruses. CHU accepts no liability for
lossor damage (whether caused by negligence or not) resulting from the use of any attached files."
 




pgsql-sql by date:

Previous
From: Raj Mathur
Date:
Subject: Re: Home-brewed table syncronization
Next
From: "adivi"
Date:
Subject: trigger proceedures in sql