hi Jennie, thanks for spending time on this!  won't LIMIT only give one record?  i need one record per event..  so i think the "insert into" command would need to be repeatedly called until every single event got stored (which would take forever)?  sorry if i'm missing something

On Wed, Jul 15, 2015 at 6:20 PM, Ying Zhang <Y.Zhang@cwi.nl> wrote:
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 <ajdamico@gmail.com> wrote:
>
> any ideas on this?  thanks!
>
> On Thu, Jun 4, 2015 at 7:39 AM, Anthony Damico <ajdamico@gmail.com> wrote:
> https://stackoverflow.com/questions/30641876/monetdb-sql-method-to-locate-or-match-by-the-nearest-value-without-a-top-or-lim
>
> 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

_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list