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
I couldn't figure out the answer..
_______________________________________________
users-list mailing list
users-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/users-list