473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cross Reference Tables in Access

Hello,
I will have two master tables A-L and M-Z which contain ticket holders.
I will have several tables which list employees of different employers.

I need to run a query on each employers table to find employees that are also in the ticketholders tables.

I started with this SQL statement but got a long list of duplicates:
Expand|Select|Wrap|Line Numbers
  1. SELECT Rewards.[Last Name], Rewards.[First Name], Rewards.Middle, Rewards.Address, Rewards.Address2, Rewards.City, Rewards.State, Rewards.Zip, Rewards.Phone, Rewards.SSN, Rewards.DOB
  2. FROM [M-Z] LEFT JOIN Rewards ON [M-Z].[SSN]=Rewards.[SSN]
  3. WHERE (((Rewards.[Last Name]) Is Null)); 
So for each employer I would run a query on A-L and another on M-Z to see if any of their employees are listed on either of the ticket holders tables.

I am new to Access and still learning so any help at all in layman's terms would be greatly appreciated.
Apr 29 '10 #1
8 6183
Jim Doherty
897 Expert 512MB
@jmorris
Welcome to Bytes :)

I see you are new :) Friendly word of advice - get to use a standard naming convention for your table and field names. Research Lechinsky/Roddick naming convention if you intend to use Access a lot, Spaces in field names generally are a pain in the proverbial, as you will doubtless learn as you progress.

Without being too verbose with this as I think I understand your need, take a look your syntax predicate at the SELECT portion of your query syntax

if you use SELECT DISTINCT it will return unique values in your resultset
If you use SELECT DISTINCTROW it will return unique records eliminating the duplication you speak about.

These settings incidentally can be got at in the query design window of access using the menubar VIEW - PROPERTIES which pops up the properties window

You might wonder the differences but it is documented in the help files in Access so I wont repeat that

Regards

Jim
Apr 30 '10 #2
NeoPa
32,556 Expert Mod 16PB
May I ask why the [M-Z] table is included in the SQL at all, as the data and all references appear to be from [Rewards]?

Excluding this gives you the full set only once of course if my guess as to your structure is accurate.
Apr 30 '10 #3
@NeoPa
Well, what I want to do is see if people in the Rewards table are in the M-Z table.
Apr 30 '10 #4
@Jim Doherty
if you use SELECT DISTINCT it will return unique values in your resultset
If you use SELECT DISTINCTROW it will return unique records eliminating the duplication you speak about.

Both worked fine thank you so much. I know I have a long way to go and I'll rely on these forums for information.
Apr 30 '10 #5
@NeoPa
I think what your saying is change

FROM [M-Z]

TO

FROM Rewards
Apr 30 '10 #6
Thanks to both of you very much!!!!
Apr 30 '10 #7
NeoPa
32,556 Expert Mod 16PB
I think what you're saying is ...
Maybe I'm confused as to what you're actually asking for help with. I assumed from your first post that it was to include the [A-L] data in with the [M-Z] data that you already had. My suggestion, to remove the [M-Z] part rather than changing it, as [Rewards] is already included in the FROM clause, would satisfy that requirement.

Rereading, that doesn't seem to be the question, but I can't really understand why that was introduced into the post at all if, as seems to be the case, you're asking specifically about removing duplicates.

As for the duplicates, I think Jim has given some good advice on that one. However, I can't help thinking that there may be a more fundamental issue here with your sructure, or maybe even just the data itself. I suspect the duplicates occur because there are multiple [M-Z] records for each SSN. Without access to your data this is hard to know. It may help to have a look through SQL JOINs to get a fuller understanding of what actually happens when JOINing tables together within a query.
May 2 '10 #8
NeoPa
32,556 Expert Mod 16PB
jmorris: Thanks to both of you very much!!!!
You're very welcome.

We'll be happy to see more of your questions :)
May 2 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Otie | last post by:
Can anyone recommend a good VB5 cross-reference program that makes reports? I have seen VB Project Eye, but it does not make reports. Thank you. --- Allen
7
by: smd | last post by:
Hello and thanks for taking the time to read this. I've looked all over the web and newsgroups and can't find a solution to my problem. I've posted this question to the Access 2000 group as well -...
0
by: jgabbai | last post by:
Hi, I am looking to pick up the relationship between items in a cross-reference table. For example, searching for c OR f (bracketed below to highlight them), I want to list the other right hand...
3
by: Harry Fuecks | last post by:
Hi All, Wondering if a tool exists to generate "cross reference" documentation for Python code bases? Particularly after something like phpxref - http://phpxref.sourceforge.net/ : written in...
3
by: maffonso | last post by:
Hi guys, I have built a cross reference query (columns is year). I would like to change the caption and adjust others things. The best way would be to wrap the query in a form, but soon 2007 will...
7
by: for.fun | last post by:
Hi everybody, I have the following problem : B class need A::MyEnum type and A class need B::MyEnum type. In both case, the class type is incomplete so it is obvious that the ::MyEnum can not...
16
MitchR
by: MitchR | last post by:
Hi All; I have a form that contains a textbox control called CPUServicetag (Serial number). My users enter in the CPUServicetag manually. My question is this ... How do I go about creating an...
1
misscrf
by: misscrf | last post by:
I have a table that acts as a cross reference to related records. No we can't get different data, no we have no control over what we have, we just need to be able to manage what we have been given....
4
by: nospam | last post by:
I have a table that acts as a cross reference to related records. No we can't get different data, no we have no control over what we have, we just need to be able to manage what we have been...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.