02-15-06, 18:29 #1Registered User
- Join Date
- Feb 2006
Unanswered: New user needs help with a simple(?) access query
OK, thanks for reading this, I apologize if I have the wrong group or something.
Anyway, I am trying to run a simple query that compares 2 tables - BOOKINGS and CONTACTS.
I would like to do 2 things:
1) Filter out any records whose CSSID in the CONTACTS table exists in the CONTACTNO in the BOOKINGS table. In other words, if the contact has purchased a service, it will appear in the bookings table. If the contact hasn't, there will be no reference to them. I want to filter in the contacts table people who have any listing in the bookings table.
2) Seperately, I would like to filter the CONTACTS table by only showing contacts who have a listing in the BOOKINGS table. Then, further filter that by the field COURSENAME ("Level One", "Level Two", etc.)
Let me know if you need more data.
Thanks tremendously for your help with this!!
02-16-06, 04:18 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
Hi Ryan, and welcome to the forum....
Have a look at the method of linking to tables together as part of an SQL statement.
It can be doen as part of a "where" clause, or preferably as part of a "join" clause.
select <table1>.<col1>, <table1>.<col2>, <table1>.<col3>, <table2>.<col1>, <table2>.<col2> from <table1> join <table2> on <table2>.<colx>=<table1>.<coly>
the access query wizards can go along way down the line to give you a few examples. It can also show you how to find unmatched rows (which is what I think you are looking for.
Have a look at those and come back if you are struggling
HTHI'd rather be riding on the Tiger 800 or the Norton