Re: NOT IN operator not working with subquery.
From: John Spencer (MVP) (spencer4_at_comcast.net)
Date: 10/26/04
- Next message: John Spencer (MVP): "Re: Help with simple delete query"
- Previous message: John Spencer (MVP): "Re: How to check a text field which has no value asigned?"
- In reply to: Terry: "NOT IN operator not working with subquery."
- Next in thread: david epsom dot com dot au: "Re: NOT IN operator not working with subquery."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 26 Oct 2004 18:50:45 -0400
Don't know without more information on your table structure. What you've posted
says that it ought to work
You might try the following
SELECT C.[Name], C.[ID#]
FROM CompanyInfo as C LEFT JOIN Invoices
On C.[ID#] = Invoices.[Link ID]
WHERE Invoice.[Link ID] is Null
Terry wrote:
>
> I want to get a list of company names that we have in our database, that we
> have not ever sent an invoice to. Why does the following query not work? I
> have been banging my head on this for about an hour and can't figure it out.
> Any help would be much appreciated.
>
> SELECT [Companyinfo].[Name], [Companyinfo].[ID#] FROM [Companyinfo] WHERE
> [Companyinfo].[ID#] NOT IN (SELECT [Link ID] FROM [Invoices]);
>
> [Invoices].[Link ID] points to [Companyinfo].[ID#]
>
> -- Terry
- Next message: John Spencer (MVP): "Re: Help with simple delete query"
- Previous message: John Spencer (MVP): "Re: How to check a text field which has no value asigned?"
- In reply to: Terry: "NOT IN operator not working with subquery."
- Next in thread: david epsom dot com dot au: "Re: NOT IN operator not working with subquery."
- Messages sorted by: [ date ] [ thread ]