NOT IN Subquery
HejHvordan laver man NOT IN Subquery? Har prøvet både med NOT IN og <>, NOT IN returnere ikke noget og <> giver mig følgende fejl "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."
Select a.SubjectNo, ai.Telephone1, ai.Telephone2
From PD.v_CrmAccount a
LEFT JOIN pd.v_CrmAccountInfo ai
ON a.AccountId = ai.AccountId
Where a.StatusCode = 'Aktiv'
AND a.AccountId NOT IN (Select p.AccountId
From pd.v_CrmPayment p
Where p.Amount > 0
AND p.PaymentDate >= '2012-04-01'
AND p.DonationType IN ('Støtte erhverv m. moms', 'Støtte erhverv u. moms')
Group By p.AccountId)