15,041
edits
| Line 420: | Line 420: | ||
* Number of question marks is not matched with the number of query values <ref>[https://stackoverflow.com/questions/10966251/sqlstatehy093-invalid-parameter-number-parameter-was-not-defined php Invalid parameter number: parameter was not defined - Stack Overflow]</ref> | * Number of question marks is not matched with the number of query values <ref>[https://stackoverflow.com/questions/10966251/sqlstatehy093-invalid-parameter-number-parameter-was-not-defined php Invalid parameter number: parameter was not defined - Stack Overflow]</ref> | ||
* The array of query values should not be the associative array. Use sequential array! | * The array of query values should not be the associative array. Use sequential array! | ||
=== ERROR 1054 - Unknown column in 'where clause' === | |||
Message: [Err] 1054 - Unknown column 'xxx' in 'where clause' | |||
Solution: | |||
# check the column name 'xxx' if exists | |||
# if the column name 'xxx' was computed by the [http://dev.mysql.com/doc/refman/5.7/en/example-user-variables.html User-Defined Variables]. Enclosed the whole query into another parent derived query. | |||
<pre> | |||
-- The query which met the error message: [Err] 1054 - Unknown column 'rank' in 'where clause' | |||
SELECT semi.*, IF(semi.id = semi.prev, @rank := @rank +1, @rank := 1 ) AS `rank` | |||
FROM | |||
( | |||
... | |||
) semi | |||
WHERE semi.rank <= 10 | |||
</pre> | |||
Enclosed the whole query into another parent derived query. | |||
<pre> | |||
SELECT final.* | |||
FROM | |||
( | |||
SELECT semi.*, IF(semi.id = semi.prev, @rank := @rank +1, @rank := 1 ) AS `rank` | |||
FROM | |||
( | |||
... | |||
) semi | |||
) final | |||
WHERE final.rank <= 10 | |||
</pre> | |||
== ERROR 1052 - Column 'column_name' in field list is ambiguous == | == ERROR 1052 - Column 'column_name' in field list is ambiguous == | ||