Search a range of cases/records - Mailing list pgsql-sql

From Wei ZOU
Subject Search a range of cases/records
Date
Msg-id 45C253FC.2040002@ucdavis.edu
Whole thread Raw
Responses Re: Search a range of cases/records
List 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 by date:

Previous
From: "Hiltibidal, Robert"
Date:
Subject: Compilation Error AIX
Next
From: "Hiltibidal, Robert"
Date:
Subject: Re: Index Anding