Sample Header Ad - 728x90

'Limit INT OFFSET @variable' throw runtime error in mysql server

0 votes
1 answer
326 views
I'm trying to solve this problem in Hackerrand The problem asks for the median in a specific column my code: SET @VAE = (SELECT COUNT(*) FROM STATION); SET @VAE1 = ROUND(@VAE/2)-1; SELECT LAT_N FROM STATION ORDER BY LAT_N LIMIT @VAE1; But I get syntax error. When I write the query as following it runs ok, but I don't want it in such way SET @VAE = (SELECT COUNT(*) FROM STATION); SET @VAE1 = ROUND(@VAE/2)-1; SELECT LAT_N FROM STATION ORDER BY LAT_N LIMIT 5; what is the problem ?
Asked by ahmad alghadban (1 rep)
Jun 14, 2023, 09:59 AM
Last activity: Nov 12, 2023, 09:32 AM