Flagging Duplicate records in a Table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table that contains three columns.

ID1, ID2, and Flag

ID1 ID2 Flag
1234 1234

I want to identify each record that is the same in ID1 and ID2 and flag it
with an "X".
 
You should not do this as when data changes the flag will be wrong. You
should just check it each time when you would look at the flag.
Below wil update the flag text field. If your field is a Yes/No the use a
-1 (minus one) to set the flag.
UPDATE MLewis SET MLewis.Flag = "Yes"
WHERE (((MLewis.ID1)=[ID2]));
 
If I want to do this as a one time shot in a Query, how can I do that?

KARL DEWEY said:
You should not do this as when data changes the flag will be wrong. You
should just check it each time when you would look at the flag.
Below wil update the flag text field. If your field is a Yes/No the use a
-1 (minus one) to set the flag.
UPDATE MLewis SET MLewis.Flag = "Yes"
WHERE (((MLewis.ID1)=[ID2]));

--
KARL DEWEY
Build a little - Test a little


MLewis said:
I have a table that contains three columns.

ID1, ID2, and Flag

ID1 ID2 Flag
1234 1234

I want to identify each record that is the same in ID1 and ID2 and flag it
with an "X".
 
What I posted was the SQL for an update query.

Create a new query, open in design view, click on menu VIEW - SQL View,
paste my post over what you see in the window. Edit it to use your field
and table names.

An exception to storing this type of flag data might be when you also have a
Datetime field to show when it was flagged.

--
KARL DEWEY
Build a little - Test a little


MLewis said:
If I want to do this as a one time shot in a Query, how can I do that?

KARL DEWEY said:
You should not do this as when data changes the flag will be wrong. You
should just check it each time when you would look at the flag.
Below wil update the flag text field. If your field is a Yes/No the use a
-1 (minus one) to set the flag.
UPDATE MLewis SET MLewis.Flag = "Yes"
WHERE (((MLewis.ID1)=[ID2]));

--
KARL DEWEY
Build a little - Test a little


MLewis said:
I have a table that contains three columns.

ID1, ID2, and Flag

ID1 ID2 Flag
1234 1234

I want to identify each record that is the same in ID1 and ID2 and flag it
with an "X".
 
Back
Top