J
J
JayDeeZz2018-04-04 17:29:34
PHP
JayDeeZz, 2018-04-04 17:29:34

Forming a request?

Have a request

set @n = 0;
SELECT
  servers.id,
  servers.game,
  servers.votes,
  @n := @n + 1 AS rank
FROM servers
ORDER BY servers.votes DESC


I need to pull data after this request by id for example id='3'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexalexes, 2018-04-04
@JayDeeZz

And why not at once in request?

SELECT *
   from (SELECT  servers.id,
                           servers.game,
                           servers.votes,
                           @n := @n + 1 AS rank
                 FROM servers, (SELECT @n := 0) r
          ORDER BY servers.votes DESC) a 
where id = 3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question