Good day! In the table, among others, there is a field "rank" (int). And it is necessary in GROUP BY to derive the difference between the first "rank" in the table and the last. That is, not between MAX and MIN, namely, between the first entry and the last one. How to do it? Thank.

http://sqlfiddle.com/#!9/373abe

PS The imposed link to a possible "duplicate" question does not contain the MySQL query operator I need.

  • And what is the "first" and "last", in what order, by id? - Mike
  • Yes! Exactly. - Choo Hwan
  • one
  • sqlfiddle.com/#!9/373abe/7 - the result. Thanks, Mike !!! - Choo Hwan
  • Can you say in a few words about this in the answer: substr (max (concat (lpad (id, 10, '0'), rank)), 11)? - Choo Hwan

0