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

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -