views:

72

answers:

2

What does adding ranked to a mysql query do?

I'm trying code from this post

SELECT * FROM ( SELECT @row := @row +1 AS rownum, [column name] FROM ( SELECT @row :=0) r, [table name] ) ranked WHERE rownum % [n] = 1

+2  A: 

Nothing, apparently, as "ranked" isn't a MySQL keyword that I can find. Did you possibly mean "ordered by"?

Zenham
+4  A: 

"ranked" is an alias that you're giving to your sub-select. You're just omitting the "AS" keyword, which is allowed in MySQL.

Example: SELECT name from MyTable AS table1

Alex