link to the last entry of the source table

Link columns by default link to the first entry of the column in the source table. But is it possible to change this such that it links to the last occurrence. I’ve a scenario where I have a time series and I need to link to the most recent update. Note that these tables are fairly big and memory mapped, so sorting a table would not be a viable option.

e.g.

q)t1:( c1:sym?cba`c; c2: 10 20 30 40)

q)t1

c1 c2


c 10

b  20

a  30

c 40

q)show t2:( c3:sym?aba`c; c4: 1. 2. 3. 4.)

c3 c4


a  1

b  2

a  3

c 4

q)select `t1!t1.c1?c3   from t2

2

1

2

0

I need the last entry above to be 3.

thanks

d:(!). value each(first;last)@':group t1.c1

update tlink:t1!d[t1.c1?c3] from t2

Thanks. There is a small mistake (as t1 and t2 might not have same #rows)

select`t1!count**[t1]-**1+reverse[t1.c1]?c3 from t2