Reputation: 256
When the following query is sent to my database:
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)
The following error is returned:
android.database.sqlite.SQLiteException: ambiguous column name: statemachines.statemachinename (code 1): , while compiling:
I have no clue what to do, all my other queries work.
Upvotes: 0
Views: 332
Reputation: 38098
Simplify: FROM actions, actionhandlers, states, statemachines
=> FROM actions
Upvotes: 2
Reputation: 44118
You use statemachines
twice. Once in the JOIN clause and once in the FROM.
Name one of them:
...
FROM actions, actionhandlers, states, statemachines AS statemachines1
...
Upvotes: 4