help creating a querry

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I go to design view and show 2 tables with identical field names, except
for 1 and connect them, and then run query what result would I be getting?

I want to run a query that compares the two tables and gives me a query of
all the matched records, how would this look in design view? There are 12
field names in one table and 13 in the other, I want to use 3 field names for
my match result, but I want to bring across all the field names, how would
this look???Any help with this would be greatly appreciated. I know I can do
this using a duplicate query but because one table has a field name that the
other does not I do not know how to get the query to append the extra field
into the matched query???
 
ssr5 said:
If I go to design view and show 2 tables with identical field names, except
for 1 and connect them, and then run query what result would I be
getting?

ssr5,

It would depend on the SELECT, FROM, and WHERE clauses of your
SELECT statement (and possibly on the GROUP BY and ORDER BY clauses,
too), as well as the table structures.

I want to run a query that compares the two tables and gives me a
query of

Queries do not produce queries. They give results in the form of
what amounts to a temporary table (it isn't an exact equivalent of a
table in MS Access, but it is close enough).

all the matched records, how would this look in design view?


SELECT T1.<column1>
,T1.<column2>
,T1.<column3...12>
FROM <your table1> AS T1
INNER JOIN
<your table2> AS T2
ON T1.<key column1> = T2.<key column1>
AND T1.<key column2> = T2.<key column2>
AND T1.<key column3> = T2.<key column3>
There are 12
field names in one table and 13 in the other, I want to use 3 field names for
my match result, but I want to bring across all the field names, how would
this look???Any help with this would be greatly appreciated. I know I can do
this using a duplicate query but because one table has a field name that the
other does not I do not know how to get the query to append the
extra field

It appears that only 3 columns will be used in determining whether
the rows match. One of those 3 columns cannot, by definition, but
the 13th column in Table 2.
into the matched query???


Sincerely,

Chris O.
 
ssr5 said:
If I go to design view and show 2 tables with identical field names, except
for 1 and connect them, and then run query what result would I be getting?

Depends on how you connect them. If you joined one field from each
table, you will get rows (of whatever fields you choose) where each
table matches on the joined fields, assuming you did not change the join
type (the default is to match in both tables).
I want to run a query that compares the two tables and gives me a query of
all the matched records, how would this look in design view? There are 12
field names in one table and 13 in the other, I want to use 3 field names for
my match result, but I want to bring across all the field names, how would
this look???Any help with this would be greatly appreciated. I know I can do
this using a duplicate query but because one table has a field name that the
other does not I do not know how to get the query to append the extra field
into the matched query???

Using the duplicate query, simply drag the 13th field from table B into
your query design.

Or, do it all yourself. Easy as 1-2-3...

Add both tables to a new query.

Draw three join lines between the tables: each line joins the fields you
want to match in your tables.

Add whatever fields you like to like to the Fields part of the design.
Add the "*" field from each table to see everything in both tables.
 
Back
Top