Dear All,
I am in need of a query from which i will get the count of distinct Production order present in a table, i have written a query as mentioned:
static void no_of_JO(Args _args)
{
WrkCtrUtilizationTable wrkCtrUtilization_New;
select Count(ProductionId) from wrkCtrUtilization_New
index hint WrkCtrGroupIdx group by wrkCtrUtilization_New.ProductionId
where wrkCtrUtilization_New.WrkCtrGroupId == 'COILING' &&
wrkCtrUtilization_New.WrkCtrId == 'C101' &&
wrkCtrUtilization_New.TransDate >= str2date("01-Jul-2012",123) &&
wrkCtrUtilization_New.TransDate <= str2date("16-Jul-2012",123) &&
wrkCtrUtilization_New.ProductionId != ' ';
info(strfmt("%1",wrkCtrUtilization_New.ProductionId));
}
but this query is generating wrong output, it displays the number of records present against the Production order i.e if Prod_00001 and Prod_00002 are repeated 10 and 20 times respectively then is generating output as 10, where as it should generate the output as 2.
Please suggest me the proper query to generate the output.
Thanks all..
*This post is locked for comments
I have the same question (0)