Monday, 12 August 2013

Using alias in mysql is not working

Using alias in mysql is not working

I am a beginner. so i am pretty much confused while using alias. for
example the below query works fine
select * from
(
select ROW_NUMBER() over (partition by prodid order by quantity desc) as
'rankin',prodid,quantity from sales
) A
where rankin=1
but when i modify like the one below i get an error "Invalid column name
'rownumber'"
select ROW_NUMBER() over (order by quantity) as 'rownumber' from sales
where rownumber = 1
Please explain the difference. i am getting stuck with basics

No comments:

Post a Comment