Compare (2) fields in (1) table

M

ModernGIS

Grettings,
I am working on a database analysis and need some assistance on building
a specific query.

I have an input table that was formed at a previous query that is composed
of a few 100 records. In one column field I have "Meter_Number_1" and in the
same table in a seperate column field I have "Meter_Number_2"

What I need to do is for each row, to identify where the number for
"Meter_Number_1" and "Meter_Number_2" are the same. In addition to that, a
sperate query will be where they are not the same.

I am starting off small and the full out analysis will include a couple
thousand records and I don't want to have to compare the data line by line.

Thanks for your help
 
X

XPS350

Grettings,
   I am working on a database analysis and need some assistance on building
a specific query.

  I have an input table that was formed at a previous query that is composed
of a few 100 records. In one column field I have "Meter_Number_1" and in the
same table in a seperate column field I have "Meter_Number_2"

What I need to do is for each row, to identify where the number for
"Meter_Number_1" and "Meter_Number_2" are the same. In addition to that, a
sperate query will be where they are not the same.

   I am starting off small and the full out analysis will include a couple
thousand records and I don't want to have to compare the data line by line.

Thanks for your help

I think the queries should lok like:
SELECT * FROM YourTable WHERE Meter_Number_1=Meter_Number_2

and
SELECT * FROM YourTable WHERE Meter_Number_1<>Meter_Number_2


Groeten,

Peter
http://access.xps350.com
 
C

Chris

Create a query with an expression, something like:

Match:iif(meter_1 + meter_2, "Yes", "No")
 
M

ModernGIS

Chris,

Little confused on exactly how I should be doing this. When I design the
query, in what field do I put the expression and on what line? Do I need to
make sure I have a field column already done?

How exactly do I write the expression

Thanks
 
K

KARL DEWEY

In design view grid blank column insert these entries --
FIELD MyMatch: [Meter_Number_1]
TABLE YourTableName
SORT - nothing -
CRITERIA [Meter_Number_2]

In other query design view grid blank column insert these entries --
FIELD NotMatch: [Meter_Number_1]
TABLE YourTableName
SORT - nothing -
CRITERIA <>[Meter_Number_2]
 

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