Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Find multiple records with 2 Matching Fields

Featured Replies

I'm needing to clear out redundant records in a table where there is, say a Foreign Key field linked to 'People' and a Content field like, oh, "Activity" (Golf, Chess, etc.) The gist is the table 'tags' people with various activities, but there should be no duplicate tags -- we only need to know that Janice plays Chess *once* -- not several times.

This seems like it should be simple, but I'm not immediately seeing it -- and I'm wondering whether there's

(a) A direct way to find all such records via a Find technique that would give me a set of all records where the FK and Activity are both matching any other record. (This need just comes up in various scenarios.

(B) what's the most efficient way to find and delete these dupes, so that each record has a unique combination of FK/Activity. I'm thinking a self-join based on 2 relationships with the two fields matching, a Summary field to count record, and a looping script to work through all records and knock down the related Count to 1? Is that the right approach?

First, backup your database.

To prevent duplicates in the future, create a text field (I'll call it "Unique" but the name does not matter) with an auto-enter calculation:

foreignkeyfield & " " & activity

Set this field to validate unique, always, and not allow user over-ride.

Now, export the data. Delete all the records. Import the data back in again with all the auto-enter options enabled. The validation will prevent duplicates from being imported.

First, backup your database.

To prevent duplicates in the future, create a text field (I'll call it "Unique" but the name does not matter) with an auto-enter calculation:

foreignkeyfield & " " & activity

Set this field to validate unique, always, and not allow user over-ride.

Now, export the data. Delete all the records. Import the data back in again with all the auto-enter options enabled. The validation will prevent duplicates from being imported.

slick Vaughan..

Kewl technique

  • Author

Ahhhhh --- nice! THis is useful in a lot of situations, because I had always been stymied in cases where I wanted to require a calc field to be Unique. Never thought of the auto-entry equivalent! Thanks a million.

I think Comment mentioned this technique w-a-y back, so I'll pass the compliments onto him (but keep 10% commission). :D

I'll pass the compliments onto him (but keep 10% commission).

If I knew that was the arrangement, I would have given you all my business...

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.