Re: SQL Question - Adding rows to the resultset

From: Gokul <>
Date: Sun, 8 Mar 2009 05:32:47 -0700 (PDT)
Message-ID: <>

Used id is similar to debit transaction. Avail id is a credit transaction. So, the idea to track which credit transactions were used to fulfill a debit transaction.

The assumption is that the debit transactions can make use of credit transactions with availid < usedid (debit can use only those credit transactions created before).

Now, if the debit transaction can be fulfilled with the available credit transactions, it is possible some thing can be carried over the next level. The next debit
transaction must take this into account.

For ex

In the example, the debit 2333 can only use 220 points of credit transaction 2304. The remaining 380 must be carried over to the next debit transaction 2654.

Debit 2654 must now make use of the carried over transaction of 380 points and not the current one. In this case, the 32 points can easily be serviced by 380 carried over. So, the current credit transaction must be made available to the next debit transaction.

Gokul Received on Sun Mar 08 2009 - 07:32:47 CDT

Original text of this message