I want to create a table called "Test" from inputTable called "Avg_Daily" using arcpy.MakeQueryTable_Management option of arcpy. However, I am getting error which says "Error 999999: An Invalid SQL statement was used". I don't know where I used invalid SQL statement. Any idea? Here is the code:
Code:
import arcpy
from arcpy import env
env.workspace ="C:/RG/Projects/CriticalDataNetwork/CDEC.gdb"
try:
inTable = "Avg_Daily"
keyField = "STATION_ID"
inField = [["Avg_Daily.OBJECTID","OBJECTID",],["Avg_Daily.STATION_ID","STATION_ID"], ["Avg_Daily.DLY_AVG", "DLY_AVG"]]
whereClause = "\"STATION_ID\" = 'CAP', 'DDM'"
outTable = "Test"
arcpy.MakeQueryTable_management(inTable, outTable, "USE_KEY_FIELDS", keyField, inField, whereClause)
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message