0

I needed to find the time lapse between two given records and getting the actual values from an specific field, please check the following example of output record set from a query:

|id_field(key)|date_field         |non-atomic_id_field|value_a|value_b|value_c|value_d  |
|0001         |2000-12-31 15:36:24|A0F767738D45RR8    |034    |2398.34|alpha  |02       |
|0002         |2000-12-31 15:38:12|A0F767738D45RR8    |033    |1198.04|alpha  |02       |
|0003         |2000-12-31 18:25:10|A0F767738D45RR8    |033    |3002.00|alpha  |02       |
|0004         |2000-12-31 18:26:00|A0F767738D45RR8    |033    |1218.04|alpha  |03←(this)|
|0005         |2000-12-31 18:26:35|A0F767738D45RR8    |033    |1118.04|alpha  |02←(this)|
|0006         |2000-12-31 18:27:31|A0F767738D45RR8    |033    |1981.04|alpha  |02       |
|0007         |2000-12-31 19:00:44|A0F767738D45RR8    |033    |1198.04|alpha  |54←(this)|

From here TIMEDIFF and CONCAT are my friends, actually this helped me a lot, but I really can't find out on how to kind of trigger(?) something that flags the first "non changed" field value and the very first "changed" value on this record set -for example- to later apply the related answer to calculate the time between id_field=0001 to id_field=0004, id_field=0004 to id_field=0005 and id_field=0005 to id_field=0007 to put it in an easy way.

That's it, I need to do it through query or a couple queries, it doesn't matter.

Thank you.

Community
  • 1
  • 1
Luis
  • 280
  • 3
  • 11

1 Answers1

0

Selecting rows where column value changed from previous.

Difference between two recordsets.

Community
  • 1
  • 1
Luis
  • 280
  • 3
  • 11