'ambiguous column name' error refers to database, table, and column guuu sqlite3 gives an 'ambiguous column name' error with the query below. The error itself references what seems to be about as an unambiguous column name as one can imagine, identifying the database as 'sourcedb', the table as 'answers', and the field as 'markup'. Why is this query triggering the error?

sqlite&gt; SELECT answers.*
        FROM   sourcedb.answers
               INNER JOIN sourcedb.questions_tests
                 ON sourcedb.questions_tests.testskey = '121212eczema'
               INNER JOIN sourcedb.answers_questions
                 ON sourcedb.questions_tests.questionskey = sourcedb.answers.questionskey
               INNER JOIN sourcedb.answers
                 ON sourcedb.answers.answerskey = sourcedb.answers_questions.questionskey; 
...&gt;    ...&gt;    ...&gt; Error: ambiguous column name: sourcedb.answers.markup


Some additional detail...

sqlite&gt; pragma table_info(answers);
0|markup|TEXT|0||0
1|identifier|TEXT|0||0
2|text|TEXT|0||0
3|answerskey|INTEGER|0||1
4|answertype|TEXT|0||0
5|ReadPerms||0||0
6|UpdatePerms||0||0
7|DeletePerms||0||0
sqlite&gt; pragma database_list;
0|main|
2|sourcedb|/root/.ttest/database/sqlite/ttest-simple.sqlite
You have FROM sourcedb.answers and INNER JOIN sourcedb.answers so you are introducing the same table twice without giving either an alias.

Some of the join conditions appear probably wrong as well. 

 FROM   sourcedb.answers
               INNER JOIN sourcedb.questions_tests
                 ON sourcedb.questions_tests.testskey = '121212eczema'


doesn't reference sourcedb.answers anywhere in the ON. 

INNER JOIN sourcedb.answers_questions
                 ON sourcedb.questions_tests.questionskey = sourcedb.answers.questionskey


Doesn't reference sourcedb.answers_questions in the ON

I presume you actually need something like

SELECT answers.*
FROM   sourcedb.answers
       INNER JOIN sourcedb.answers_questions
         ON sourcedb.answers.answerskey = sourcedb.answers_questions.questionskey
       INNER JOIN sourcedb.questions_tests
         ON sourcedb.questions_tests.questionskey = sourcedb.answers.questionskey
WHERE  sourcedb.questions_tests.testskey = '121212eczema'