>Hilmar,
>Don't you sleep?
It seems I posted this particular message at ca. 9:00, local time (13:00 UTC). I am usually connected during work hours, in the morning (11:00 - 16:00 UTC), but sometimes I briefly check in the afternoon, too.
>Do you have an opinion on another approach?
In my experience, the subquery is usually fast enough. Perhaps you can post the actual query.
>this one is faster:
>Select t1.FieldList, sum(t1.Field1) ;
> from t1 ;
> where !t1.Field2 ;
> and t1.<SameField> not in ;
> ( select ;
> t2.<SameField> ;
> from t2 ) ;
> group by t1.Field3
>
It seems an index on Field1 would help. An index on Field2 (logical field, right?) might slow the query down, so experiment both with and without this index.
>I've tried pulling the individual records into a temp cursor first (no sum(Field1)), then selecting the sum() of the temp cursor, but that doesn't appear to have any effect.
>
>I'm just about to give up on this. In theory, there should not be any records in t1 without mathching records in t2, so I just might make this a cleanup routine that gets run once a week and to heck with how long it takes.
With referential integrity in place, you can be almost sure to avoid fields in Table2 that don't match a record in Table1. If your programming logic fails, the user will get a "trigger failed" error, and the changes won't be saved. Do you use referential integrity here?
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)