join,group by,sum,多表联接汇总,复杂的Join语句

whileselect ItemId,sum(Qty), sum(QtySec), WrkCtrID, InventSizeId, ConfigId, InventcolorId, UnitId, UnitIdSec

 

                                from _NJ_WIP GroupBy ItemId ,WrkCtrID, InventSizeId, ConfigId, InventcolorId, UnitId, UnitIdSec

 

                                join  Prodid,ACT_ProdCancelId,SalesId, CustAccount, DlvDate

 

                                from _prodTable groupby Prodid,ACT_ProdCancelId,SalesId, CustAccount, DlvDate

 

                                where  _NJ_WIP.WrkCtrId like "01c2"

                                    && _NJ_WIP.ProdId == _ProdTable.ProdId

 

 

 

static void calculateCommission(Args _args)
{
    InventTable             inventTable;
    CustInvoiceTrans        custInvoiceTrans;
    ;
    while select CommissionGroupId from inventTable group by CommissionGroupId
      join sum(LineAmount) from custInvoiceTrans
    where
      custInvoiceTrans.itemId == inventTable.ItemId &&
      custInvoiceTrans.invoiceId == "U000033"
    {
        .......
    }
}

 

posted @ 2011-09-20 11:35  perock  阅读(730)  评论(0编辑  收藏  举报