
You can achieve this with a self join. The idea is that you build a subselect that gives you the minimum value for each id, and then join that to the original table by id. SELECT a.id, a.value-b.min_value FROM "table" a INNER JOIN (SELECT id, MIN(value) AS min_value FROM "table" GROUP BY id) AS b ON a.id = b.id; I've posted this on Stackoverflow. Thanks for the heads up, Percy On Thu, Feb 28, 2013 at 10:32 AM, Anthony Damico <ajdamico@gmail.com> wrote:
http://stackoverflow.com/questions/15136868/why-is-group-by-giving-only-one-...
I couldn't figure out the answer..
_______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
-- Percy Wegmann +1 512 637 8500 ext 148