A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

comparing tables



 
 
Thread Tools Display Modes
  #1  
Old September 8th, 2004, 12:11 AM
external usenet poster
 
Posts: n/a
Default comparing tables

Does anyone know how I could find all the values in one table that are not in another?
I have a table named login; the fields are ID, first_name, last_name...
I have another table named tb; the fields are ID, tb_ID, and last_tbdate.
Here's the relationship: ID.login ---------- tb_ID.tb
The ID fields in both tables are unique key autonumber.
EX. login:
ID first_name last_name
1 jeremy scott
2 john doe
3 jane michaels
4 brian peterson
5 bill gates

EX. tb
ID tb_ID last_tbdate
1 1 09/02/2003
2 1 09/01/2002
3 3 09/05/2004
4 5 09/10/2003
5 5 09/10/2002

The answer should be:
first_name last_name
john doe
brian peterson

because neither john nor brian have any records in the tb table.
i can't seem to get this to work and any halp would be much appreciated thanks


  #2  
Old September 8th, 2004, 12:44 AM
Tonín
external usenet poster
 
Posts: n/a
Default

SELECT login.first_name, login.last_name
FROM login LEFT JOIN tb ON login.ID = tb.tb_ID
WHERE tb.tb_ID Is Null;


Tonín

escribió en el mensaje
k.net...
Does anyone know how I could find all the values in one table that are not

in another?
I have a table named login; the fields are ID, first_name, last_name...
I have another table named tb; the fields are ID, tb_ID, and last_tbdate.
Here's the relationship: ID.login ---------- tb_ID.tb
The ID fields in both tables are unique key autonumber.
EX. login:
ID first_name last_name
1 jeremy scott
2 john doe
3 jane michaels
4 brian peterson
5 bill gates

EX. tb
ID tb_ID last_tbdate
1 1 09/02/2003
2 1 09/01/2002
3 3 09/05/2004
4 5 09/10/2003
5 5 09/10/2002

The answer should be:
first_name last_name
john doe
brian peterson

because neither john nor brian have any records in the tb table.
i can't seem to get this to work and any halp would be much appreciated

thanks




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing two tables Daniel Running & Setting Up Queries 1 June 14th, 2004 09:19 PM
comparing two tables Spiro General Discussion 1 June 5th, 2004 01:43 PM
comparing two tables ADAK Running & Setting Up Queries 1 May 28th, 2004 06:07 PM


All times are GMT +1. The time now is 01:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.