if statement query

M

msam137

I am trying to run create a microsoft query any help would be forever
appreciated. I want to compare two tables lets say table1 field A and
table2 field A I want to be able to create a table of all the fields
that are in table1 Field A that are not in table2 Field A. Along with
the result set I want the additional columns that are in table1. Table1
field A and Table2 field A have the same format and possible data in
them both. After this result set I will want to try to take it a step
furhter by extending the comparison to a second column that are in both
tables.
 
R

Rick B

Sounds like an unmatched query. when you click on new query, that is one of
the wizrds that are available to you.
 
N

Norman Yuan

SELECT FieldA,FieldB...INTO tblNew
FROM table1
WHERE FieldA NOT IN (SELECT table2.FieldA FROM table2)
 
M

msam137

Norman appreciate your help I had tried Rick's and got the results that
I was looking for just did not understand how the Is Null accomplished
that.
But Norman where would I key your command at.
 
R

Rick B

In short, it pulls records from both tables and sort of places them side by
side. If there is not a record in the second table, then the key field you
are comparing is blank for that table.

That is a non-technical explanation of an unmatched query.

(Note: If you view your query in SQL (click VIEW/SQL View) you will see a
statement like the one Norman posted for you.



Rick B
 
M

msam137

ok that is great can I also type up my own commands in that view sql
window inside access.
 
J

John Vinson

ok that is great can I also type up my own commands in that view sql
window inside access.

Just be aware that the JET/Access dialect of SQL is nonstandard (just
in a different manner than the non-standardness of SQL/Server, MySQL,
Oracle, etc. etc.) - if you're used to SQL/Server T-SQL you'll need to
make adjustments.

John W. Vinson[MVP]
 
Top