find a record in range of a number

From: larry postgres <forpostgresql(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: find a record in range of a number
Date: 2006-02-21 22:58:26
Message-ID: 20060221225826.94422.qmail@web37405.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi ..I have done search but cannot find situation that fits.

I need to do a search or select if you will on a table that contains over 150,000 records. Within this table there are 2 columns I am interested in. One is low_number and other is high_number. I need to find the record(s) that these two columns are in range of a number passed to it through the select statement.

Example:

I want to do a search for all records that the number 301 falls between the low_number and high_number in that same, particular record.

I have in the column low_number of a record the number 280 and in the high_number column I have the number 310. I am doing a search for all the records that the number 301 will be in range of for the columns low_number and high_number in each particular record.

Since I have passed the number 301 to the select statment. It should return to me the record number that has the values for the low_number at 280 and high_number 310.

I have tried to use RANGE and BETWEEN but they also return records out of range.

Can anyone point me in right direction?

Any help much appreciated.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2006-02-21 23:34:16 Re: find a record in range of a number
Previous Message Christian Stalp 2006-02-21 18:34:50 plpgsql-function with timestamp