distで並べ替えたい:distはisNeighbourという関数から返されたdouble値ですdistが未定義であるため、エラーがスローされます:フィールドリストの不明な列'dist'
DELIMITER $$
DROP PROCEDURE IF EXISTS `connectarabs`.`maxEdges` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `maxEdges`(id int,lat double,lon double,rad double)
BEGIN
if lat is null then
set lat=(select a.latitude from account a where a.id=id);
end if;
if lon is null then
set lon=(select a.longitude from account a where a.id=id);
end if;
SELECT friends.* FROM account friends left join account_friendTest me on (friends.id=me.second_account)
or (friends.id=me.first_account) where (me.first_account=id OR me.second_account=id) AND friends.id <> id AND
( ((select isNeighbour(lat,lon,friends.latitude,friends.longitude,rad) as dist )<rad) ) order by dist;
END $$
DELIMITER ;