title: MySQL Stored procedure variables from SELECT statements
body: <p>I'm trying to create a stored procedure. Here's what I have so far (not working):</p>
  
  <pre><code>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 |
  </code></pre>
  
  <p>HAVERSINE is a function I created which works fine. As you can see I'm trying to take the id of a city from the cities table and then set cityLat and cityLng to some other values of that record. I'm obviously doing this wrong here by using SELECTs. </p>
  
  <p>Is this even possible. It seems it should be. Any help whatsoever will be greatly appreciated.</p>