Hi:
   
  I finally decided to build a mixed solution:
  I get the rows from the query and, by X++,  I get the average
  (total there are few rows):
      :
      :
   
      PriceDiscTable     priceDiscTable;
    Int                xCount;
    Real               xRetailPriceSum;
    ;
      while select ItemRelation, inventDimId, accountRelation, Amount, 
maxof(ToDate)
            from priceDiscTable
            group by ItemRelation, inventDimId, accountRelation, Amount
            //join inventDim
            where PriceDiscTable.ItemRelation == _itemId
            && PriceDiscTable.Module == ModuleInventCustVend::Cust
            && PriceDiscTable.Currency == _currency
            && PriceDiscTable.InventDimId == _inventDimId
            {
                xCount = xCount + 1;
                xRetailPriceSum += priceDiscTable.amount;
              }
            _RetailPriceAvg = XRetailPriceSum / xCount;
  
    return [_RetailPriceAvg];

Max Belugin <[EMAIL PROTECTED]> wrote:
          I think the only way to do such thing - is to create a view for the
inner query. But I am noyt sure it is possible for that query

On 1/24/08, Steeve Gilbert <[EMAIL PROTECTED]> wrote:
> One thing for sure si that you cannot do "embedded" (forgot the real
> term) sql statement. I'm talking about the sql statement between
> parenthesis. Make a view with that statement and use the view
> instead. The rest should be ok.
>
> Steeve...
>
> --- In [email protected], "jquinteroz"
> <[EMAIL PROTECTED]> wrote:
> >
> > Hi!:
> >
> > I have the following SQL statement:
> >
> > select f.itemRelation, f.inventDimId, avg(f.Amount) from
> > (select itemRelation, inventDimId, accountRelation, max(toDate)as
> > maxdate from PriceDiscTable
> > group by itemRelation, inventDimid, accountRelation)
> > as x
> > inner join PriceDiscTable as f
> > on f.itemRelation = x.itemRelation
> > and f.inventDimid = x.inventDimId
> > and f.accountRelation = x.accountRelation
> > and f.toDate = x.maxdate
> > group by f.itemRelation, f.inventDimId
> > order by f.itemRelation
> >
> > How I can translate this code to X++?.
> >
> > Regards.
> >
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>

-- 
Max Belugin, http://belugin.info , ICQ:9406811, MSN: [EMAIL PROTECTED]


                         

       
---------------------------------
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

[Non-text portions of this message have been removed]

Reply via email to