7

I need to join one feature class and one table. This is a one to multiple join, therefore, my only option seems to be by creating a query table. My problem is that the fields I want to join do not seem to be matched properly when I run the query table tool. I've tried using the following expression in the query table expression field to indicate that these are the fields to be joined:

'FishingAreaGroundFishNafoUnit.Code' = 'FishArea_Code_homeports_TotalValue.Code'

However instead of returning a table with just a few hundred records, I get one with 42,000 records which makes no sense at all.

I think I may be doing something wrong (perhaps the problem is with my query), but I'm not sure what. When I verify my query in the query builder window, I keep getting a message saying

The expression was verified successfully but no records were returned

which does not make any sense as there should definitely be some matches.

I've also been using his thread (bottom post) to guide myself in creating the query table http://forums.esri.com/Thread.asp?c=93&f=1728&t=172344in

2
  • I forgot to mention, I am using ArcGIS 10....
    – user2118
    Mar 3, 2011 at 12:50
  • 2
    Could you post the query that you are trying to use?
    – Zachary
    Mar 3, 2011 at 14:35

3 Answers 3

11

OK, I found the answer to my own question after calling ESRI's tech support.

To make a query table, follow all the steps described in the last post of this thread http://forums.esri.com/Thread.asp?c=93&f=1728&t=172344in .

When you get to step 4, do as it says: In the Expression box, enter a join statement using a shared attribute that will be used to append the second table to the first table such as Stations.StationID = Temperature.StationID.

However, make sure you do not enclose your field names in brackets, quotation marks or any characters for that matter. If you verify your query syntax, you will get an error message. Don't worry about it and just run the Make Query Table tool.

And voilà!

2
  • 1
    Interesting that you have to ignore an error to get an expected result. Quite some design, there. I was having trouble with query tables, as well. This will prove useful. +1
    – Nathanus
    Mar 4, 2011 at 16:58
  • I could not get this tool to work using data in SDE (SQL Server) with or without the quotes. I had to move my data into a FGDB and then removing the quotes worked.
    – Dowlers
    Nov 5, 2014 at 19:25
1

These links are specifically for 10
Deciding relationship class, join or relate

essentials for joining

0

Ok, make query table nearly drove me insane. They key elements are that the fields you wish to query on NEED to be indexed and the query needs no quotations, brackets etc within the query. Only use fields in the Fields section that are indexed. And in Key Field Options use 'Add_Virtual_Key_Field'. Even though I have managed to get it to work I'm really not sure the results are correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.