Example below
can be used as sample code to find duplicate records from table using X++, either in AX 2012 or Dynamics 365 for finance and operations.
static void
rdWrkCtrValidationDupRecords(Args _args)
{
rdWrkCtrValidation wrkCtrValidation;
while
select count(RecId)
from wrkCtrValidation
group
by wrkCtrValidation.WrkCtrId
{
if(wrkCtrValidation.RecId
>1)
info(strFmt('%1 - %2',wrkCtrValidation.WrkCtrId,
wrkCtrValidation.RecId));
}
}
Query in SQL for similar requirement.
SELECT
WRKCTRID,OUTPUT,COUNT(*)
FROM
rdWrkCtrValidation
GROUP BY
WRKCTRID,OUTPUT
HAVING
COUNT(*) > 1