I have two tables:
- user
2)purchases.
For each purchase, there are many columns but two of them are the most relevant:
1)email of the user
2) a unique link
I want to add a column in the user table that will automatically be filed by the LAST (newest) link of the purchase for each user.
So for example, Bob bought a book. So I will have a new row in the purchase table with Bob’s email and a unique link and date of purchase.
Now I need to find a way that will copy the link to the column in the user table that calls (for example) “last link of purchase”
It’s not a regular relation, because I need to have the relation on the newest row.
How can I do it? What am I missing?