Select data from table NOT IN another table

  • Thread starter gmazza via AccessMonster.com
  • Start date
G

gmazza via AccessMonster.com

Hey there,
How can I make a query to Select data from one table that doesn't exist in
another table.
For example, I have 2 tables.
Table 1 - Trademark
Data: 1 2 3

Table 2 - Competitor
Data 1 2

So on my Competitor form, I have a combo box and I want to only see the
values from Trademark that aren't already in Competitor. I want my query to
return 3.

Obviously there is more going on, just wanted to give a quick rendition of
what I need, hope it makes sense.
Thanks!
 
B

Beetle

SELECT [SomeField] FROM Table1
WHERE Table1.[SomeField]
NOT IN (SELECT [SomeField] FROM Table2)
 
K

KARL DEWEY

Try this --
SELECT Data
FROM Trademark LEFT JOIN Competitor ON Trademark.Data = Competitor.Data
WHERE Competitor.Data Is Null;
 
G

gmazza via AccessMonster.com

Worked perfect, thanks Beetle!
SELECT [SomeField] FROM Table1
WHERE Table1.[SomeField]
NOT IN (SELECT [SomeField] FROM Table2)
Hey there,
How can I make a query to Select data from one table that doesn't exist in
[quoted text clipped - 13 lines]
what I need, hope it makes sense.
Thanks!
 
T

Tomteta

Hello all,

do you know how different a statement would be to select items from one
table that Are in another

Background: I have a huge list of contacts in one table with an email flag
and another table w only the contacts that are the ones I want to change the
flag to 0

So Im trying to select all items from one table
that are in another. I just having a hard time getting the SQL right. I
ultimately need to run an update statement w these values.
 
D

Douglas J. Steele

SELECT Table1.Field1
FROM Table1 INNER JOIN Table2
ON Table1.ID = Table2.ID
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top