I am reading Development 3 course and at some point, this discussions comes into place - optimize communication with database using fieldlist.
Ex:
while select AmountCurCredit from ledgerJournalTrans
{
amountCurCredit += ledgerTrans.AmountCurCredit;
}
I understand this, we are selecting only the AmountCurCredit field and not the others. So if we try to sum up the AmountCurDebit we will have 0 as a result.
OK, but what about this :
while select recId from inventTable
join qty from inventTrans
where inventTrans.itemId == inventTable.itemId
{
qty += inventTrans.qty;
}
itemId is not part of the select statement. How does it get a value ? Is it because it's defined as an index for both InventTable and InventTrans tables?
I mean, shouldn't we use:
while select ItemId from inventTable
join qty, ItemId from inventTrans
where inventTrans.ItemId == inventTable.ItemId
{
qty += inventTrans.qty;
}