I have two tables

table 1 (orders) columns: (date,symbol,qty)
table 2 (marketData) columns: (date,symbol,close price)

I want to add the close for T+0 to T+5 to table 1.

```
{[nday]
    value "temp0::update date",string[nday],":mdDates[DateInd+",string[nday],"] from orders";
    value "temp::temp0 lj 2! select date",string[nday],":date,sym,close",string[nday],":close from marketData";  
    table1::temp   
} each (1+til 5)

```

I'm sure there is a better way to do this, but I get a 'loop error when I try to run this function. Any suggestions?