I´m trying that one collum of my table is linked and update with data from another tablet, with some conditions.
I have two tables:
Table 1 => academias
Column1 = gym_id (only one data for each gym_id)
Table 2 => operations (This table comes from a cloud database, and is getting new data regurlary for each gym_id)
Column1 = gym_id (number)
Column 2 = kind (1,2,3 or 4)
Column 3 = created_at (date)
As you can see, both tables has the gym_id column.
So, I want to add a virtual collum named max_created_at at the academia table.
That brings the max created_at from operations, that matches the gym_id, and the kind = 4.
I have tried a lot of things, but is not working.