SQL Select Statement for Order By in Ax 2012

I am using the same table Bill_TabMethod for SQL Count.

Bill_TableData

Step 1. Write the below SQL Select statement in a Job like below

CODE:

static void SQLArrangeDesc(Args _args)

{

Bill_TabMethod btm;

while select * from btm order by btm.TotalAmt desc

print btm.TotalAmt;

pause;

}

Step 2. Run the code you will get the Result as

orderbyDesc

SQL Select Statement for COUNT in Ax

I am using the same table Bill_TabMethod for SQL Count.

Step 1. Write the below SQL Select statement in a Job like below

CODE:

static void SQLCount(Args _args)

{

Bill_TabMethod btm;

while select count(CustName) from btm

print “Number of Records :  “,btm.CustName;

pause;

}

Step 2. Run the code you will get the Result as

Number of Records : 11

Yes you have done…