Left outer join with two key fields, MakeQueryTable ?

Discussion created by vki on Sep 16, 2011
Latest reply on Sep 19, 2011 by vki

I???m quite new to both Python and ArcGIS and I can???t figure out how to solve the following problem:
I have two tables  (???A??? and ???B???) which both have a first key_field (???number???) and a second key field ???subnumber???.  Table ???A??? has more records than table ???B???.
Now I have to select all those records from table ???A??? that are NOT contained in table ???B??? too.  (Later on I have to loop through those records.)

I tried the following statement:
arcpy.MakeQueryTable_management(tableList, ???query1???,"USE_KEY_FIELDS", key_fields_List, ??????, whereClause)

tableList: table ???A??? and ???B???
query1:  new Table view
key_fields_List:  A.number, A.subnumber,B.number, B.subnumber
where clause: B.number is NULL

I get the following error message: An invalid SQL statement was used. [query1].
As soon as I run it without the key_fields_List and a where_clause, it runs ok and the two tables get joined (somehow???).  I guess it???s my key_fields_List that???s wrong??? (I tried it just with "number, subnumer" as well, but I get the same error.)
Does anyone know how I have to define the different terms of the MakeQueryTable-statement? Or is there a different way how I could solve my problem?

Thanks for your help