mysql add tag
anoldmaninthesea
I'm trying to solve the following exercise: https://www.hackerrank.com/challenges/weather-observation-station-20/problem

and my attempt was 

```
Select round(st.LAT_N,4),
from station as st
order by st.LAT_N asc
LIMIT (ceil((Select count(*)
from station)/2)-1),1;
```
(Select count(*) from station) -> gives the total number of rows in the table.

ceil((Select count(*) from station)/2) - > gives the middle row (if the number of rows is odd)

I subtract one, since otherwise the limit would start to offset after my middle row.  


However, when I run the code, I get

> ERROR 1064 (42000) at line 4: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 
>'from station as st 
>order by st.LAT_N asc
>LIMIT (ceil((Select count(*)
>from stati' at line 2

Why doesn't it work?

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.