Answers for "mysql select and procedure"

SQL
0

MYSQL stored procedure select from

DELIMITER |
CREATE PROCEDURE getNearestCities(IN cityID INT)
    BEGIN
        DECLARE cityLat FLOAT;
        DECLARE cityLng FLOAT;
        SET cityLat = SELECT cities.lat FROM cities WHERE cities.id = cityID;
        SET cityLng = SELECT cities.lng FROM cities WHERE cities.id = cityID;
        SELECT *, HAVERSINE(cityLat,cityLng, cities.lat, cities.lng) AS dist FROM cities ORDER BY dist LIMIT 10;
    END |
Posted by: Guest on August-14-2021

Code answers related to "mysql select and procedure"

Code answers related to "SQL"

Browse Popular Code Answers by Language