SQLite Forum

INNER JOIN error
Login
Here's your command:

<code>UPDATE activity_overview
    SET 'D3' = 1
    FROM activity_overview
        INNER JOIN query_projects
        ON activity_overview."Project ID"= query_projects."Project ID"
        WHERE activity_overview."Early Start" < query_projects."Planned Start"</code>

Here's the error message:

<code>Error: ambiguous column name: activity_overview.Early Start</code>

So look at your SQLite command and search for things that might define <code>activity_overview.Early Start</code>.

And there are indeed two of them.  You use the table name <code>activity_overview</code> twice.  Once immediately after the <code>UPDATE</code> keyword, and again after <code>FROM</code>.

When you refer to <code>activity_overview</code> SQLite doesn't know whether to use the current row of the <code>UPDATE</code> command or the current row from the <code>INNER JOIN</code>.

One way to fix this would be to use a table alias for one of them.  For instance

<code>UPDATE activity_overview AS activity_update …</code>