Subject Re: [firebird-support] Re: What's wrong with this query?
Author Mark Rotteveel
vladman992000 wrote:
> Thank you for the input. Basically I'm taking a table of email
> addresses to be added to a list of recipients, and my goal is that the
> query should only add email addresses that don't already exist for the
> nominated client (A_CLIENT_ID) in the RECIPIENTS table already
> (basically avoiding duplicate entries).
>
> Hope that explains it a bit better.

Ok, then this query probably works:

SELECT te.email_address
FROM temp_email3 te
LEFT JOIN recipient re ON te.email_address = re.email_address
WHERE re.fk_client_id = :A_CLIENT_ID
AND re.email_address IS NULL

You do have to make sure that temp_email3 only contains the addresses
for this client.

--
Mark Rotteveel <Avalanche1979@...>