What I want is all ACC.FULL NAME = 'NAME' appointments for the past 2 years where the AQ.F_ CONTACT field has not yet been filled in.
The table COUNT$ACQUISITIE is not linked to all Contacts. That's why i use a full outer join.
select DISTINCT C.K_CONTACT, C.NAME, a.D_BEGIN
from nomad.ACTIONS as A
inner join ACTI_CONT as AC on A.K_ACTION = AC.K_ACTION
Inner join CONTACTS as C on AC.K_CONTACT = C.K_CONTACT
inner join ACC_ACCOUNTS as ACC on A.K_USER = ACC.K_USER
full outer join .CONT$ACQUISITIE as AQ on C.K_CONTACT = AQ.K_CONTACT
ACC.FULLNAME = 'NAME'
A.D_BEGIN >= '01-01-2017'
PLANNED = 1
AQ.F__CONTACT is null