I want to prevent the insert duplicates values in table to solve this issue i use the syntax "WHERE NOT EXISTS" but not working so please what is the correct syntax to solve this problem.
INSERT INTO [JPCustomer] ([CustomerID ],
[JPID],
[Frequency],
[StartWeek],
[sat],
[sun],
[mon],
[tue],
[wed],
[thu],
[fri],
[VisitOrder],
[ModifiedOn],
[ModifiedBy],
[CreatedOn],
[Createdby],
[RecordSource],
[IsPotential])
select cu.CustomerNo,
jp.ID,
4,
1,
1,
1,
1,
1,
1,
1,
1,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
0
from CUSTOMERNO# cu
join SalesmanNo# sa on cu.OCCURRENCE = sa.OCCURRENCE
join JourneyPlan JP on jp.AssignedTO = sa.SalesmanNo
WHERE NOT EXISTS (select j.CustomerID,j.JPID from JPCustomer j)