mysql stored procedure select from

Solutions on MaxInterview for mysql stored procedure select from by the best coders in the world

showing results for - "mysql stored procedure select from"
Maeva
27 Mar 2018
1DELIMITER |
2CREATE PROCEDURE getNearestCities(IN cityID INT)
3    BEGIN
4        DECLARE cityLat FLOAT;
5        DECLARE cityLng FLOAT;
6        SET cityLat = SELECT cities.lat FROM cities WHERE cities.id = cityID;
7        SET cityLng = SELECT cities.lng FROM cities WHERE cities.id = cityID;
8        SELECT *, HAVERSINE(cityLat,cityLng, cities.lat, cities.lng) AS dist FROM cities ORDER BY dist LIMIT 10;
9    END |
10