Hello, I am trying to update one table based on another table data as follows: TableStatus containts fields date (date), hour (time), IDcode (text), status (text). TableProduct contains fields state (text), datestate (date), IDcode (text). I want to update state and datestate based on the last status in Tablestatus. The problem is that I cannot extract a max(hour) from PG, and using max(date) is not sufficient, as 2 status could be entered on the same day on two different times. I am unsure how to resolve this problem. TIA