动态多关联查询

 1 Void click()
 2 {
 3     InventDim inventDim;
 4     InventSum inventSum;
 5     InventQty inventQty;
 6     itemID    YourItemID;
 7     ;
 8     YourItemID = 'YourItemID';
 9     while select sum(postedQty), sum(received), sum(deducted), sum(registered), sum(picked), sum(reservPhysical)
10         from InventSum group by itemId
11         join  InventDim
12         where inventSum.inventDimId      == inventDim.inventDimId &&
13               inventSum.itemId           == YourItemID            &&
14               inventDim.inventLocationId == 'YourLocationID'                       
15     {
16         inventQty = inventSum.PostedQty + inventSum.Received + inventSum.Deducted - inventSum.Picked - inventSum.ReservPhysical;
17         info(strfmt('%1', inventQty));
18     }
19 }
posted @ 2012-08-30 11:46  Sprite.z  Views(205)  Comments(0Edit  收藏  举报