Unmatched Columns

T

Tom

I have a Access DB that two different colums should be the same match
(Number). I need to create a Query that will give me the ones that do not
match exactly.

Your help is appreciated.
 
K

Klatuu

If both columns are in the same table, why are there two columns with the
same value?

SELECT * FROM MyTable WHERE [FirstNumber] <> [SecondNumber];

Use your own table and field numbers
I have copywrites on my example :)
 
T

Tom

What the columns are for is a accural amount and what was actually paid. I
need the query to only give me the ones that DO NOT Match.

Does what you show below give me this? If yes, how would I put it in the
query?

I know you may think a rookie.

Thanks
--
Tom


Klatuu said:
If both columns are in the same table, why are there two columns with the
same value?

SELECT * FROM MyTable WHERE [FirstNumber] <> [SecondNumber];

Use your own table and field numbers
I have copywrites on my example :)
--
Dave Hargis, Microsoft Access MVP


Tom said:
I have a Access DB that two different colums should be the same match
(Number). I need to create a Query that will give me the ones that do not
match exactly.

Your help is appreciated.
 
K

Klatuu

If you are saying you have a calculated field in your table, you are making a
mistake. One of the basic rules of database normalization is not to store
calculated values, but in any case, this is the important part:

WHERE [FirstNumber] <> [SecondNumber];

If you are doing this in query design view, you can put the following in the
Criteria row of the FirstNumber column:

<> [SecondNumber]

That will filter out all records where the two fields have the same value.
--
Dave Hargis, Microsoft Access MVP


Tom said:
What the columns are for is a accural amount and what was actually paid. I
need the query to only give me the ones that DO NOT Match.

Does what you show below give me this? If yes, how would I put it in the
query?

I know you may think a rookie.

Thanks
--
Tom


Klatuu said:
If both columns are in the same table, why are there two columns with the
same value?

SELECT * FROM MyTable WHERE [FirstNumber] <> [SecondNumber];

Use your own table and field numbers
I have copywrites on my example :)
--
Dave Hargis, Microsoft Access MVP


Tom said:
I have a Access DB that two different colums should be the same match
(Number). I need to create a Query that will give me the ones that do not
match exactly.

Your help is appreciated.
 
T

Tom

I tried what you said and it did not work due one field is a number and the
other is a text. Examples: 0029201----29201, 002990----3990. I may have to
make the values the same type Right? The file is so big it is diffucult to
do this cause of the way the data is imported.

Do you know how to get around this issue to give me the result I want.

Thanks
--
Tom


Klatuu said:
If you are saying you have a calculated field in your table, you are making a
mistake. One of the basic rules of database normalization is not to store
calculated values, but in any case, this is the important part:

WHERE [FirstNumber] <> [SecondNumber];

If you are doing this in query design view, you can put the following in the
Criteria row of the FirstNumber column:

<> [SecondNumber]

That will filter out all records where the two fields have the same value.
--
Dave Hargis, Microsoft Access MVP


Tom said:
What the columns are for is a accural amount and what was actually paid. I
need the query to only give me the ones that DO NOT Match.

Does what you show below give me this? If yes, how would I put it in the
query?

I know you may think a rookie.

Thanks
--
Tom


Klatuu said:
If both columns are in the same table, why are there two columns with the
same value?

SELECT * FROM MyTable WHERE [FirstNumber] <> [SecondNumber];

Use your own table and field numbers
I have copywrites on my example :)
--
Dave Hargis, Microsoft Access MVP


:

I have a Access DB that two different colums should be the same match
(Number). I need to create a Query that will give me the ones that do not
match exactly.

Your help is appreciated.
 
J

John W. Vinson

I tried what you said and it did not work due one field is a number and the
other is a text. Examples: 0029201----29201, 002990----3990. I may have to
make the values the same type Right? The file is so big it is diffucult to
do this cause of the way the data is imported.

Change the criterion to

WHERE [FirstNumber] <> Val([SecondNumber]);

assuming that SecondNumber is the text field.

Or (better) improve the way the data is imported so that the fields are of the
same datatype (preferably numeric), and put indexes on the fields.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top