jrotunda85 9 Junior Poster

So I'm trying to figure out the best way (if possible) to combine these two stored procedures. Basically these are the same, the only difference is one is looking at a 'Spot' table, the other is looking at the 'Retail' table. However, in both cases the column count is the same and most of the column names are even the same (with the exception of RetailID vs SpotID and RName vs SName). Any help would be much appreciated!

/* Procedure structure for procedure `EventsNear1` */

/*!50003 DROP PROCEDURE IF EXISTS  `EventsNear1` */;

DELIMITER $$

/*!50003 CREATE DEFINER=`root`@`localhost` PROCEDURE `EventsNear1`(Lat1 float,Long1 float,distance float)
BEGIN
SELECT a.RetailID, a.RName, a.Addr_Street, a.Addr_City, b.Description, a.Addr_Zip, a.PhoneNbr, a.WebAddr, ROUND(DistanceBetween(Lat1,Long1,a.latitude,a.longitude),2) as 'Distance(Miles)'  from retail a LEFT JOIN cd_states b on a.Addr_State = b.Code where DistanceBetween(Lat1,Long1,a.latitude,a.longitude)<distance order by DistanceBetween(Lat1,Long1,a.latitude,a.longitude);
END */$$
DELIMITER ;

/* Procedure structure for procedure `EventsNear2` */

/*!50003 DROP PROCEDURE IF EXISTS  `EventsNear2` */;

DELIMITER $$

/*!50003 CREATE DEFINER=`root`@`localhost` PROCEDURE `EventsNear2`(Lat1 FLOAT,Long1 FLOAT,distance FLOAT)
BEGIN
SELECT a.SpotID, a.SName, a.Addr_Street, a.Addr_City, b.Description, a.Addr_Zip, a.PhoneNbr, a.WebAddr, ROUND(DistanceBetween(Lat1,Long1,a.latitude,a.longitude),2) AS 'Distance(Miles)'  FROM spot a LEFT JOIN cd_states b on a.Addr_State = b.Code WHERE DistanceBetween(Lat1,Long1,a.latitude,a.longitude)<distance ORDER BY DistanceBetween(Lat1,Long1,a.latitude,a.longitude);
END */$$
DELIMITER ;