Android 列名称不明确,但请使用“";”&引用;指定表格
将以下查询发送到我的数据库时:Android 列名称不明确,但请使用“";”&引用;指定表格,android,sql,sqlite,inner-join,Android,Sql,Sqlite,Inner Join,将以下查询发送到我的数据库时: SELECT statemachines.statemachinename, states.statename, actionhandlers.actionhandler, actions.value, actions.sourcename FROM actions, actionhandlers, states, statemachines INNER JOIN rules ON (actions.rule_id AND rules.rule_id)
SELECT statemachines.statemachinename,
states.statename,
actionhandlers.actionhandler,
actions.value, actions.sourcename
FROM actions, actionhandlers, states, statemachines
INNER JOIN rules ON (actions.rule_id AND rules.rule_id)
INNER JOIN actionhandlers ON (actions.actionhandler AND actionhandlers.actionhandler)
INNER JOIN states ON (states.state_id AND actions.state_id)
INNER JOIN statemachines ON (states.statemachinename AND statemachines.statemachinename)
WHERE (rules.eventname = 'PIR') AND (statemachines.currentstate = states.state_id)
返回以下错误:
android.database.sqlite.SQLiteException: ambiguous column name: statemachines.statemachinename (code 1): , while compiling:
我不知道该怎么办,我所有的其他查询都能用。您使用
状态机两次。一次在JOIN子句中,一次在FROM中
说出其中一个:
...
FROM actions, actionhandlers, states, statemachines AS statemachines1
...
您使用状态机两次。一次在JOIN子句中,一次在FROM中
说出其中一个:
...
FROM actions, actionhandlers, states, statemachines AS statemachines1
...
简化:来自动作、动作处理程序、状态、状态机
=>来自动作
简化:来自动作、动作处理程序、状态、状态机
=>来自动作
它是否识别出它是相同的状态机,我可以只删除from子句中的状态机吗?我想我现在明白了,我只需要在from中声明一个表,其他表在集中时被发现(通过内部联接),它不承认它是相同的状态机吗,我可以只删除from子句中的状态机吗?我想我现在明白了,我只需要在from中声明一个表,其他表在集中时被发现(通过内部联接)