I have two tables on two different databases.
I wish to select the values from the field MLS_LISTING_ID from the table mlsdata if they do not exist in the table ft_form_8.
There are a total of 5 records in the mlsdata table. There are 2 matching records in the ft_form_8 table.
Running this query, I receive all 5 records from mlsdata instead of 3.
Changing NOT IN to IN, I get the 2 matching records that are in both tables.
Any ideas?
SELECT DISTINCT
flrhost_mls.mlsdata.MLS_LISTING_ID
FROM
flrhost_mls.mlsdata
INNER JOIN
flrhost_forms.ft_form_8 ON flrhost_mls.mlsdata.MLS_AGENT_ID = flrhost_forms.ft_form_8.nar_id
WHERE
flrhost_mls.mlsdata.MLS_LISTING_ID NOT IN ((SELECT flrhost_forms.ft_form_8.mls_id))
AND flrhost_mls.mlsdata.MLS_AGENT_ID = '260014126'
AND flrhost_forms.ft_form_8.transaction_type = 'listing'