Skip site navigation (1) Skip section navigation (2)

Re: select a range of data

From: Jon Sime <jsime(at)mediamatters(dot)org>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: select a range of data
Date: 2007-07-20 19:19:13
Message-ID: (view raw or whole thread)
Lists: pgsql-admin
Jessica Richard wrote:
> If I have a column with a value like "abc2457", "efg1234",
> how do I select col from table where col like 'a[a-z]c24[0-9]7"?
> How do I handle the range bracket in the query?

You can use the regular expression operator(s), like so:

     select *
     from table
     where column ~ 'a[a-z]c24[0-9]7';

For the full details:


Senior Systems Developer
Media Matters for America

In response to

pgsql-admin by date

Next:From: Tom LaneDate: 2007-07-20 19:19:52
Subject: Re: select a range of data
Previous:From: Jessica RichardDate: 2007-07-20 19:00:18
Subject: select a range of data

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group