MySQL commands: Difference between revisions

Jump to navigation Jump to search
11 bytes added ,  29 April 2016
m
Line 106: Line 106:
# if the column name 'xxx' was combined 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.
# if the column name 'xxx' was combined 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>
<pre>
-- query which met he problem: [Err] 1054 - Unknown column 'rank' in 'where clause'
-- 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`   
SELECT semi.*, IF(semi.id = semi.prev, @rank := @rank +1, @rank := 1 ) AS `rank`   
FROM
FROM

Navigation menu