Using WHERE NOT EXISTS in MS Access SQL Query

后端 未结 2 1520
予麋鹿
予麋鹿 2021-01-24 08:52

I have a query that matches a field from a query to another field from a table. Here is the query:

SELECT DISTINCT CarriersToSend.Carrier, [Dual Year Carrier Re         


        
2条回答
  •  执笔经年
    2021-01-24 09:25

    Your semi colon should come after the closing parenthesis. Apart from that, your query will logically never return any records. That's because your subquery returns a result and then you are trying to return a result that doesn't match the result of the subquery. This will logically result in a false condition. Try this instead:

    SELECT DISTINCT EE_First, EE_LAST
    FROM [Dual Year Carrier Report]
    WHERE NOT EXISTS 
    (
    SELECT '1'
    FROM CarriersToSend INNER JOIN [Dual Year Carrier Report] ON 
    CarriersToSend.Carrier = [Dual Year Carrier Report].TPA_CARRIER
    );
    

提交回复
热议问题