I have tow tables say A and B which is having date field and amount field respectively. Have to check whether a.date > b.date if yes then check a.amount > b.amount if yes then do a.amt - b.amt until we get a.amount < b.amount (basically create mutliple rows)
ex: a. amount ---2000
b.amount is 200
1st row -----2000
....10th row --0
It's hard to tell without more details, DDL, some INSERTs and the expected result.
You can probably do that using WITH RECURSIVE or maybe EXPAND ON in TD13.10