because one wants the actual z.svcmon value in the result, not it's abs.distance to a.svcmon ;-) ----- On Jul 17, 2015, at 4:39 PM, Eyal Rozenberg eyalroz@technion.ac.il wrote:
This is probably more of a question than an answer, but - why wouldn't this work?:
CREATE TABLE nearest_matches AS ( SELECT a.* , ( SELECT min(abs(z.svcmon - a.svcmon)) FROM person_table AS z WHERE a.yr = z.yr AND a.person_id = z.person_id ) AS nearest_month FROM event_table AS a ) WITH DATA
(... that is, aggregation instead of TOP 1.)
Eyal
On 04/06/2015 14:39, 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
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |