0

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

Community
  • 1
  • 1
jcee14
  • 908
  • 3
  • 15
  • 28

2 Answers2

5

"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 Weinstein
  • 9,823
  • 9
  • 42
  • 59
2

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

markh
  • 783
  • 4
  • 10