Re: how to count string occurrence in column

From: "Jules Alberts" <jules(dot)alberts(at)arbodienst-limburg(dot)nl>
To: postgres <pgsql-general(at)postgresql(dot)org>
Subject: Re: how to count string occurrence in column
Date: 2002-08-27 09:48:40
Message-ID: 200208270952.g7R9q9SM028562@artemis.cuci.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 27 Aug 2002 at 10:35, Lee Kindness wrote:
> Actually i'm sure the original poster is after something like:
>
> SELECT count('qwerty qwert qwertyffff fff qq', 'qwerty');
> count
> --------
> 2
> (1 row)

I think this should do it:

select count (*) from table where columnname ~* 'substring';

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jules Alberts 2002-08-27 09:51:43 Re: how to count string occurrence in column
Previous Message Peter Gibbs 2002-08-27 09:42:22 Re: Cast Type