Flagging Duplicate records in a Table

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".
 
G

Guest

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]));
 
G

Guest

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".
 
G

Guest

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".
 

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

Similar Threads


Top