-1

I would to do something such as:

SELECT Position INTO lastPosition FROM ranking 
ORDER BY ranking.Time DESC ranking.Position DESC LIMIT 1;

but i get this error:

enter image description here

and:

enter image description here

and:

enter image description here

The goal is to select last row (limit 1) of ranking ordered by descendent position and ascendent time.


Update

The problem was a missing comma after the first DESC, the correct statement is

SELECT Position INTO lastPosition FROM ranking 
ORDER BY ranking.Time DESC, ranking.Position DESC LIMIT 1;

as noticed @Solarflare.

shogitai
  • 1,348
  • 14
  • 30

1 Answers1

1

The problem was a missing comma after the first DESC, the correct statement is

SELECT Position INTO lastPosition FROM ranking 
ORDER BY ranking.Time DESC, ranking.Position DESC LIMIT 1;

as noticed by @Solarflare.

Community
  • 1
  • 1
shogitai
  • 1,348
  • 14
  • 30