Search a range of cases/records

Поиск
Список
Период
Сортировка
От Wei ZOU
Тема Search a range of cases/records
Дата
Msg-id 45C253FC.2040002@ucdavis.edu
обсуждение исходный текст
Ответы Re: Search a range of cases/records  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings:

I have a dataset of two columns:
price amount
99.5   10000
99.7   8000
100    3000
100.1  1000
100.5  500
100.8  1500
105    2000
200    100
etc
I have to write a SQL query on how many price tags are within [price+-1]
such as 98.5 to 100.5, 100+-1,etc for each records.
Here I know the price tags counts are 5 for 99.5-100.5, 5 for
99.7-100.7, 6 for 99-101, etc
How should I do for all of the records?

Thanks in advance.

Wei
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFwlP8llCA8yArcwwRAiFsAJ0Vmbkj5BRjRJ6zokrHdYZEgpHujACgjbiL
bcw0Lcpcfdt74CXkBNaWAqQ=
=pTSo
-----END PGP SIGNATURE-----


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

Предыдущее
От: "Hiltibidal, Robert"
Дата:
Сообщение: Compilation Error AIX
Следующее
От: "Hiltibidal, Robert"
Дата:
Сообщение: Re: Index Anding