Hi,
How to create X++ query for Group By ??

My select statement is simply like this (in Transact SQL)

select a.salesid, sum(b.lineamount) from salestable a, salesline b
where a.salesid=b.salesid
group by a.salesid

I try to build in X++ like this, but it cause error said that there's 
no Group by 

dsSalesTable = q.addDataSource(tablenum(SalesTable));
dsSalesLine = dsSalesTable.addDataSource(tablenum(SalesLine));
dsSalesLine.addLink(FieldNum(SalesTable, SalesId), FieldNum
(SalesLine,SalesId));
dsSalesLine.JoinMode(JoinMode::InnerJoin);
dsSalesLine.addSortField(FieldNum(SalesLine, SalesId));
dsSalesLine.orderMode(ordermode::GroupBy);
dsSalesLine.addSelectionField(FieldNum(SalesLine, LineAmount), 
SelectionField::Sum);

Thanks in advance,






------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/kGEolB/TM
--------------------------------------------------------------------~-> 

Sharing the knowledge on Axapta. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Axapta-Knowledge-Village/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to