"Error getting a list of OIDs from the table" returned when opening a geodatabase table with a definition query after joining to another table in a geodatabase
Write the definition query prior to the join, and reference the fields using the tablename.fieldname syntax, or recreate the definition query after the join.