Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2007

Tip: Looking for answers? Try searching our database.

No duplicates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ladybug - 18 Jan 2007 21:05 GMT
I know that I should know this, but I am having a complete dumb moment.

Here is a simple example.

I have two tables.  1st table has red, blue, green, yellow, orange
2nd table has red, green, orange

I want to do a query that returns blue and yellow

I want to know out of the first table what is not in the second table.
Jason Lepack - 18 Jan 2007 21:21 GMT
You need what is called an Outer Join (Left or Right).  Join the two
tables based on the field "Colour" and you will get an "Inner Join".
Now double click on the join and you will be shown the Join Properties
screen.  Choose "Include all records from the table with the most
colours and only those from the table with the least colours where they
are equal" (or something like that).  Then you want to add the Colour
field from each of the two tables, but for criteria for the table with
the least colours you want to put "Is Null"

(Boy, it sounds convoluted to do it that way)

Or if you know how to input SQL you can use this:
SELECT Table1.colour
FROM Table1 LEFT JOIN Table2 ON Table1.colour = Table2.colour
WHERE Table2.colour Is Null;

Table1:
colour - Text - Primary Key

Table1 Values:
Red
Yellow
Blue
Green
Orange

Table2:
colour - Text - Primary Key

Table2 Values:
Red
Green
Orange

Query1:
SELECT Table1.colour
FROM Table1 LEFT JOIN Table2 ON Table1.colour = Table2.colour
WHERE Table2.colour Is Null;

Query1 Results:
Blue
Yellow

Cheers,
Jason Lepack

> I know that I should know this, but I am having a complete dumb moment.
>
[quoted text clipped - 10 lines]
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200701/1
Tim Ferguson - 22 Jan 2007 16:46 GMT
"ladybug via AccessMonster.com" <u21071@uwe> wrote in news:6c7be9cdd7066
@uwe:

> I want to know out of the first table what is not in the second table.

 select thing
 from first
 where thing NOT IN
 ( select thing from second )
 order by thing

Hope that helps

Tim F
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.