notexists join in ax 2012 x++

you have 2 tables, the first table contains ‘123’ record and the second table do not

the question: how to view table in first table that not contains record in second table

case: I want to know, what item that is not in sales


in basic sql:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
declare @dataareaid varchar(4);
set @dataareaid = 'Tes';
select
  distinct
  a.itemid
from
  inventtable a
  left join salesline b
    on a.dataareaid=b.dataareaid
      and a.itemid=b.itemid
where
  a.dataareaid=@dataareaid
  and b.itemid is null
order by 
  a.ITEMID

so, the record will show the item that are not in sales line.
how about in x++ version? we used notexist join
this is the code 

1
2
3
select inventtable
  notExists join salesline
    where inventtable.itemid==salesline.itemid
now, the problem is time, how much did it take for loading all these data?
in sql server, it takes for 16ms

when i Tried to test on ax, it loads for 3-4 seconds

Comments

Popular posts from this blog

Inventory Calculation – BAHASA