How to select most recent records per unique ID

0
Hi, I have a table with weights recorded for containers as they go through a processing line. I want to select the most recent weight per lot ID. The lot IDs are dynamically generated so I cant predefine them in the expression. Im hoping to: split the table into parts with values for each unique ID pick the most recent record from each part return a list of those most recent values per ID Im open to getting here some other way, or I can redesign the weight recording process so that it uploads the weight to a ‘current’ table and deprecates the previous value to a table of older records. However Im sure what I suggested is possible? Its not very hard to do with SQL.
asked
1 answers
0

Hi Leron,

Add a date attribute where it holds the [%CurrentDateTime%] whenever processing line is happening.

Try to write an OQL which is similar to SQL where you can get the recent record.

 

Select distinct lotId, weight,max(date atr) from MyFirstModule.Test

group by lotID, weight.

 

the above query will give you the recent weight for each lotid which is processed

 

answered