How Group by clause work in MSD Axapta x++


How Group by clause work in Axapta x++

If we use group by clause in ax then we should know how it work . for example

select tabletest group by testno,testgroup;

it means you will get record by grouping of testno and testgroup but it there is no field selected that means its internally two fields testno,testgroup is in select query means actual query working like this.

select testno,testgroup from tabletest group by testno,testgroup;

you can also select group by clause with while like this

while select tabletest group by testno,testgroup
{
statements;
-----------
----------
}

if we take aggregate funtion with group by clause like this

select count(recid) from tabletest group by testno,testgroup;

then actual query will work like this


select count(recid),testno,testgroup from tabletest group by testno,testgroup;