Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy Forums > > >

Solved: Comparison of two columns in Access


(!)

vinwin06's Avatar
Computer Specs
Member with 362 posts.
THREAD STARTER
 
Join Date: Jul 2010
Experience: Intermediate
12-Sep-2012, 10:10 PM #1
Solved: Comparison of two columns in Access
Hi All,

I need an help in finding out duplicates values in two different columns. Like for example i have Column A and COlumn B , suppose if any value in Column B if its available in Column A then i need to update as "1" in column C. How i can do that in access. Becuase i tried to give the criteria as "Column A = COlumn B" but this is not working effectively. Find some samples below;

Column AColumn BColumn C1111245658796565879657896524789652456977455697745564789656478965202786520278647008874700887419898841989883697090369709031951913195191168949526932931187597219139468569851689495123456511875977899555568569854557899

In this example the second row value in Col A is available as first row value in COl B , in this case i need to update as "1" in col C in second row.
Attached Files
File Type: zip Comparison_test.zip (5.8 KB, 11 views)
draceplace's Avatar
draceplace   (Dan) draceplace is offline
Computer Specs
Member with 1,566 posts.
 
Join Date: Jun 2001
Location: Conway, Arkansas
13-Sep-2012, 08:28 AM #2
VinWin, not able to follow your data or download the file at work...but Expr1: IIF([ColumnA]=[ColumnB],1,0) will be something like what you want.
vinwin06's Avatar
Computer Specs
Member with 362 posts.
THREAD STARTER
 
Join Date: Jul 2010
Experience: Intermediate
13-Sep-2012, 10:47 AM #3
I have tried with the same formula you have given but its updating all value as "0". i don't know whats wrong with the data.....
draceplace's Avatar
draceplace   (Dan) draceplace is offline
Computer Specs
Member with 1,566 posts.
 
Join Date: Jun 2001
Location: Conway, Arkansas
13-Sep-2012, 12:36 PM #4
that is correct, none of the data in the spread sheet matches A to B. the crap is off by a row or something. If you put this in C2:
=IF(A3=B2,1,0)

the matches are staggered for the first 9 rows then no matches. Garbage in garbage out.
vinwin06's Avatar
Computer Specs
Member with 362 posts.
THREAD STARTER
 
Join Date: Jul 2010
Experience: Intermediate
13-Sep-2012, 12:38 PM #5
yeah but how i will do it in access.... that is my concern
draceplace's Avatar
draceplace   (Dan) draceplace is offline
Computer Specs
Member with 1,566 posts.
 
Join Date: Jun 2001
Location: Conway, Arkansas
13-Sep-2012, 12:43 PM #6
If you want to find the matches you can pull the table in to a query 2 times and join it on its self A to B
vinwin06's Avatar
Computer Specs
Member with 362 posts.
THREAD STARTER
 
Join Date: Jul 2010
Experience: Intermediate
13-Sep-2012, 01:07 PM #7
i want those records when is A<> B
draceplace's Avatar
draceplace   (Dan) draceplace is offline
Computer Specs
Member with 1,566 posts.
 
Join Date: Jun 2001
Location: Conway, Arkansas
13-Sep-2012, 01:31 PM #8
You data is garbage, I don't see a viable resolution. You can join the table to its self A to B with a right or left join then take the nulls from one table and those will be non matched records. I'm not sure of thier value
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 17,801 posts.
 
Join Date: Mar 2005
Location: UK
13-Sep-2012, 01:32 PM #9
So do you want to find duplicate values or where A<>B as stated in post #7?
Will all duplicates have a 1 placed in them?
vinwin06's Avatar
Computer Specs
Member with 362 posts.
THREAD STARTER
 
Join Date: Jul 2010
Experience: Intermediate
13-Sep-2012, 01:44 PM #10
I need to have values where A<>B , so it means that unique values in column A only be available.
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 17,801 posts.
 
Join Date: Mar 2005
Location: UK
13-Sep-2012, 02:16 PM #11
Presumably you want to list the Unique Values, I think to do so you may need to have a new field in the table to indicate that the the value is duplicated somewhere in the database.
You can't do this with just one query, you may be able to identify them with 2, but maybe not.
I would need a table to play with.
__________________
OBP
I do not give up easily
vinwin06's Avatar
Computer Specs
Member with 362 posts.
THREAD STARTER
 
Join Date: Jul 2010
Experience: Intermediate
13-Sep-2012, 02:29 PM #12
Find attached the sample one i have posted....
Attached Files
File Type: zip Database1.zip (9.4 KB, 7 views)
vinwin06's Avatar
Computer Specs
Member with 362 posts.
THREAD STARTER
 
Join Date: Jul 2010
Experience: Intermediate
13-Sep-2012, 02:37 PM #13
In the sample i have attached if fun_2 column has one time "A0101" but if fun_1 has the same value several times means we need to delete it from Fun_1 column.
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 17,801 posts.
 
Join Date: Mar 2005
Location: UK
13-Sep-2012, 02:43 PM #14
That data has a lot of duplication in field Fun_1, do you want unique values for that as well?
Can you show the output you want, does it include both fields?
vinwin06's Avatar
Computer Specs
Member with 362 posts.
THREAD STARTER
 
Join Date: Jul 2010
Experience: Intermediate
13-Sep-2012, 02:48 PM #15
No i want the result only in fun_1 but any value in fun_2 should not be in here in the result.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑