Select to view content in your preferred language

A quick tip on performing a 1:M join

5471
0
05-10-2012 03:37 AM
Labels (1)
LucasDanzinger
Esri Frequent Contributor
2 0 5,471
MQT1-137x300.pngHave you ever had a 1:M relationship but did not want to perform a relate? You might consider using the Make Query Table tool to accomplish this task. Typically when performing a 1:M join, only the first record will be joined and the subsequent records will not. In instances such as this, I often recommend using a relate or relationship class instead of a join. However, using the Make Query Table tool is another option for performing this task and can also be an effective way of querying out matching records from two separate tables or feature classes.

You can access this tool by navigating to the ArcToolbox > Data Management Tools > Layers and Table Views >  Make Query Table. To perform this, your tables and/or feature classes must be in the same location (the same file, personal, or SDE geodatabase).Steps
  1. First add your table, then your feature class to the Input tables box.
  2. Select the Fields you want in the resulting table view.
    *If you want to include geometry in the output and not just a table view, be sure to select the shape fields.
  3. Click SQL. Write a statement similar to the one in the following graphic. This statement is basically saying, give me all records that match between the table and the feature class. Click OK.MQT2.png
  4. Give your Table a name.
  5. Select the option to use Virtual Key Fields.
  6. Click OK.
  7. Once this finishes running, export the output to a new feature class, as this is only an event layer and will not save outside of the MXD.

For more on this tool, please visit the Resource Center help page for the Make Query Table tool.Lucas D. - Desktop Support Analyst
About the Author
I'm a Geographer working in Product Development at Esri, focusing my time on the ArcGIS Runtime SDKs. I'm an Esri Certified ArcGIS Desktop Professional (10 years experience working with ArcGIS) with a wide range of technical skills including native application development, spatial databases, desktop/web GIS, and scripting. My Master's degree is in GIS with a focus in Natural Resource Management. Currently, I'm most interested in building cross-platform and lightweight apps using our ArcGIS Runtime SDK for Qt.