select records by nearest value

From: e-letter <inpost(at)gmail(dot)com>
To: pgsql-novice-owner(at)postgresql(dot)org
Cc: pgsql-novice(at)postgresql(dot)org
Subject: select records by nearest value
Date: 2011-05-14 10:49:16
Message-ID: BANLkTi=Y1p9gyMR566Y71UgH3tLrv1mU7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Readers,

A database is structured as follows:

1 text1
1000 text2
500 text3

where column 1 consists of integers. Is it possible to create query
that will select the most appropriate records for a sum of integers.
For example, if the target sum of integers is 50, is it possible to
select a set of records that will be closest to this value?

Thanks in advance.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Frank Bax 2011-05-14 12:27:33 Re: select records by nearest value
Previous Message Birchall, Austen 2011-05-12 13:29:41 More WAL archiving/backup questions