Using alias in mysql is not working -


i confused usage of alias. example, query below works fine

select *  ( select row_number() on (partition prodid order quantity desc) 'rankin',prodid,quantity sales ) rankin=1 

but when modify shown in snippet below error: "invalid column name 'rownumber'".

select row_number() on (order quantity) 'rownumber' sales rownumber = 1 

please explain difference.

this because select executed after where , from executed before where cannot used in second query can used in first query.


Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -