find a record in range of a number

Поиск
Список
Период
Сортировка
От larry postgres
Тема find a record in range of a number
Дата
Msg-id 20060221225826.94422.qmail@web37405.mail.mud.yahoo.com
обсуждение исходный текст
Ответы Re: find a record in range of a number  (Michael Fuhr <mike@fuhr.org>)
Список 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_numbe r 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

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Christian Stalp"
Дата:
Сообщение: plpgsql-function with timestamp
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: find a record in range of a number