SQL statement error: "Column does not exist"
In the provided SQL statement, the error message indicates that the FK_Numbers_id column does not exist in the database table. However, upon inspecting the table structure, it is clear that the FK_Numbers_id column does exist.
The problem stems from the case sensitivity of column names with double quotes. The table appears to be created with quoted column names, which makes them case sensitive. In this case, the FK_Numbers_id column name must be enclosed in double quotes:
<code class="language-sql">select sim.id as idsim, num.id as idnum from main_sim sim left join main_number num on ("FK_Numbers_id" = num.id);</code>
By correctly enclosing the column name in double quotes, the SQL statement now accurately references the target column.
The above is the detailed content of Why Does My SQL Query Return 'Column Does Not Exist' Even Though the Column Exists?. For more information, please follow other related articles on the PHP Chinese website!