
Maybe I’m thinking in a too simple way, but if you store the intermediate results in a table, you can use LIMIT 1: CREATE TABLE t1 (svcmon int); -- assume svcmon is an INT insert into t1 SELECT svcmon FROM person_table AS z WHERE a.yr = z.yr AND a.person_id = z.person_id ORDER BY abs( z.svcmon - a.svcmon ) LIMIT 1; Using TEMP TABLE might give you a bit speed up, but then you need to put them in one transaction. Jennie
On Jun 13, 2015, at 07:47 , Anthony Damico
wrote: any ideas on this? thanks!
On Thu, Jun 4, 2015 at 7:39 AM, Anthony Damico
wrote: https://stackoverflow.com/questions/30641876/monetdb-sql-method-to-locate-or... i'm thinking i can do this with some costly self-join, but i'd appreciate any other eyes on the problem
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list