Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Help with a join query.

Author  Topic 

michpaust
Starting Member

21 Posts

Posted - 2005-12-06 : 09:38:17
I am trying to create a query based on a join between two tables. My code is as follows

SELECT SPSPoHead.*
FROM [Exclude Vendor] INNER JOIN SPSPoHead ON [Exclude Vendor].[Vendor Name] <> SPSPoHead.Vendor

The query ideally should compare the two tables and exclude any records in exclude vendor from the query result. The problem is that if there is more than one record it doesn't work. One record it works perfectly and I will not find the vendor name in the result.

I know that I am missing something simple here but I can't wrap my brain around it. Any help will be great.



--I don't suffer from insanity. I enjoy every minute of it.--

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-06 : 09:52:12
SELECT *
FROM SPSPoHead Where [Vendor Name] not in (select [Vendor Name] from [Exclude Vendor])



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

michpaust
Starting Member

21 Posts

Posted - 2005-12-06 : 10:08:07
I tried doing that but there is no join between the two tables so it didn't work. I have two tables SPSPoHead and Exclude Vendor and I am trying to exclude the records from exclude vendor from the query result and they are joined on the field Vendor Name in Exclude Vendor and Vendor in SPSPoHead.

--I don't suffer from insanity. I enjoy every minute of it.--
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-07 : 02:09:26
Did you try the query I suggested?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -