Right now this doens't work correct since PEEK looks at the previous record and the records are not sorted. However if I use the ORDER BY function within the first LOAD statement I get the message 'Garbage after statement'. I could put another LOAD statement in between but this seems a lot of trouble for the operation I want. Is there a smoother way to achieve the desired table: Restriction in the WHERE clause and no duplicate records from TripStopID? BTW I can't use Distinct since T_TRIPSTOP contains a lot more fields which are not all equal. Thanks in advance!
Re: Loading data partially based on unique records and field values
This works! However I'm not sure if I can incorporate it. For each of the TRIPSTOPS I need to Aggregate various Quantities to get the quantity for this tripstop. I use a Group by combined with an aggregation to get the desired result and Join it with the Unique records. The Group By requires a resident load which still leaves me with a temporary table. Is there a way to Aggregate over the tripstop within the initial load?