View Full Version : querying value from earlier record to compare with current record


PaulA
05-16-2002, 12:08 PM
Greetings!

I want to retrieve a value (a date) from the previous record to compare with the value of the current record: ie, to calculate the number of days between the two dates. To complicate this, the log in question has multiple customers so I would want the date comparison to be dates corresponding to that customer.

How would I do this in a query?

Thanks.

David R
05-16-2002, 01:50 PM
The best answer depends on how you can identify what the 'last' record is. Is it via autonumber? date/time stamp? etc?

I would pull out the records for just that customer, then either use a series of queries to get fields from the last two records and subtract them, or use code (look up the PrevRecVal function on the KS Knowledge Base) to find the last two records.