Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

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.


pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group