Lets say we a database like this:

"customer_id";"info1";"info2"
"1";"firstinfo";"secondinfo"
"1";"somemoreinfo";"evenmoreinfo"

Is it possible to store previous database fields in variables if a certain field does not change? I already found this macro that checks if a value changes, but I would also like to fetch data from previous record.

To make things even more complicated, the amount of repeating customer_id can be anything from 1 to n. And of course I should print only the last customer_id containing all the data.

Is thing beyond PSM scripting? I could ask the database provider to group the records as one or maybe I will roll my sleeves and write a program that parses through the data and appends the data of previous record to next one if these criterias are met.