By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,963 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,963 IT Pros & Developers. It's quick & easy.

How to create a query for comparing 2 fields from a table

P: 5
Hello!!!!!!!!

In MS ACCESS i need to create a query that compares 2 fields from a single table and generate a report or redirect to a report which should consist of matched data among 2 fields and unmatched data seperately from field1 and field2.
Jan 30 '08 #1
Share this Question
Share on Google+
7 Replies


MindBender77
100+
P: 234
Hello!!!!!!!!

In MS ACCESS i need to create a query that compares 2 fields from a single table and generate a report or redirect to a report which should consist of matched data among 2 fields and unmatched data seperately from field1 and field2.
It might be easier to create 2 separate queries. One for matched data and the second for unmatched data. Then create the report(s) based on those queries.

Hope this points you in the right directions,
JS
Jan 30 '08 #2

P: 5
It might be easier to create 2 separate queries. One for matched data and the second for unmatched data. Then create the report(s) based on those queries.

Hope this points you in the right directions,
JS

Fine then what will be the query for matching and unmatching in access
Jan 30 '08 #3

MindBender77
100+
P: 234
Hello!!!!!!!!

In MS ACCESS i need to create a query that compares 2 fields from a single table and generate a report or redirect to a report which should consist of matched data among 2 fields and unmatched data seperately from field1 and field2.
Try this for Matching:
Expand|Select|Wrap|Line Numbers
  1. SELECT Field1, Field2
  2. FROM YourTable
  3. WHERE (((Field1)=[Field2]))
  4. GROUP BY Field1, Field2;
  5.  
Then for Unmatching:
Expand|Select|Wrap|Line Numbers
  1. SELECT Field1, Field2
  2. FROM YourTable
  3. WHERE (((Field1)<>[Field2]))
  4. GROUP BY Field1, Field2;
  5.  
Hope this Helps,
JS
Jan 30 '08 #4

P: 5
Try this for Matching:
Expand|Select|Wrap|Line Numbers
  1. SELECT Field1, Field2
  2. FROM YourTable
  3. WHERE (((Field1)=[Field2]))
  4. GROUP BY Field1, Field2;
  5.  
Then for Unmatching:
Expand|Select|Wrap|Line Numbers
  1. SELECT Field1, Field2
  2. FROM YourTable
  3. WHERE (((Field1)<>[Field2]))
  4. GROUP BY Field1, Field2;
  5.  
Hope this Helps,
JS



In Access where do we write queries like these.........It seems to be as SQL Query.If i am wrong plz do correct me and tell me where do i write this query in MS access
Jan 31 '08 #5

MindBender77
100+
P: 234
In Access where do we write queries like these.........It seems to be as SQL Query.If i am wrong plz do correct me and tell me where do i write this query in MS access
You can write these sql queries in access by opening a query in SQL View from the query designer.

JS
Jan 31 '08 #6

P: 5
You can write these sql queries in access by opening a query in SQL View from the query designer.

JS

One more doubt!!!!!!!!!!

Every item of Field1 should be compared to all attributes of Field2 and then produce the result...............(ie)comparing all items of Field 1 to Field2 and then producing the common items in bith the Fields..............i think this time have put up my right question.............plz do tell me how the query has to be written(codings)
Feb 1 '08 #7

P: 5
You can write these sql queries in access by opening a query in SQL View from the query designer.

JS

One more doubt!!!!!!!!!!

Every item of Field1 should be compared to all attributes of Field2 and then produce the result...............(ie)comparing all items of Field 1 to Field2 and then producing the common items in both the Fields..............and even not matching ones..........i think this time have put up my right question.............plz do tell me how the query has to be written(codings)
Feb 1 '08 #8

Post your reply

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