转自:https://blog.csdn.net/Gan_1314/article/details/125798360
SELECT bm.id, bm.merchant_name AS merchantName, bm.address, bm.signboard_pic AS signboardPic, CAST( ( st_distance ( point ( lng, lat ), point ( #{lng}, #{lat} ) ) * 111195 ) AS DECIMAL ( 10, 0 ) ) AS distance,GROUP_CONCAT(bc.card_info) AS cardInfo FROM base_merchant bm LEFT JOIN base_card bc ON bm.id = bc.merchant_id WHERE bm.STATUS = '1' AND bm.switch_status = '0' <if test="merchantName != null and merchantName != ''"> and bm.merchant_name like concat('%', #{merchantName}, '%')</if> <if test="tradeId != null "> and bm.trade_id = #{tradeId}</if> GROUP BY bm.id ORDER BY distance ASC
标签:merchant,distance,经纬度,bc,bm,距离,排序,id From: https://www.cnblogs.com/person008/p/16650534.html