I’m working on an app to take meter readings and I am unsure how to handle grabbing certain rows of data from a list. I have a parent/child relationship, one-many. The problem is, I need to find the difference between each consecutive child entry. How can I grab the two most recent rows for the given id? I’d also like to display the most recent row with the parent in table view.
example: Parent table [id,name] 1, Unit 1 2, Unit 2
Child table [id, meter reading, Virtual col Difference] 1, 0, 0 2, 300,0 1,100,100 1,1000, 900 1, 1500, 500 2, 500, 200 etc