Re: Most specific match using between

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Most specific match using between
Date: 2005-04-21 16:25:06
Message-ID: 20050421162506.GC28259@gp.word-to-the-wise.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 21, 2005 at 09:51:16AM -0600, mmiranda(at)americatel(dot)com(dot)sv wrote:
> Hi people, is there a swtich or something to instruct a between statement
> hat it must perform a most specific match ?
> These are the details, i have these table
>
> name | start | end
> ---------------+---------------+-----------------
> general | 2660000 | 2669999
> specific | 2660124 | 2660124
> (2 rows)
>
>
> unsing the query: select name where '2660124' between start and end
>
> i got:
>
>
> name
> ---------
> general
> specific
>
>
> How can i get only specific?

....ORDER BY end-start ASC LIMIT1; ?

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message "pgsql-general 2005-04-21 16:58:05 Re: Finding cardinality of an index
Previous Message mmiranda 2005-04-21 16:18:31 Re: Most specific match using between