sql查询在本地工作,但不在生产上工作

ewm0tg9j  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(194)

我试着在localhost(sequel pro)中运行以下查询,结果是正确的,但是当我试着在产品上运行时,“distance”和“branch\u name”字段是空的。本地mysql版本为5.5.58,生产mysql版本为5.7.2
这是查询。

SELECT *, 
       @distance    AS distance, 
       @branch_name AS branch_name 
FROM   `bg_offers` 
WHERE  `end_datetime` > 2019 - 12 - 12 
       AND EXISTS (SELECT *, 
                          @branch_name := branches.branch_name, 
                          @distance := ( 6371 * Acos(Cos(Radians(25.2097)) * 
                                                     Cos(Radians(map_latitude)) 
                                                     * 
                                                     Cos( 
                                                     Radians(map_longitude) 
                                                     - Radians( 
                                                     55.2478) 
                                                                    ) + Sin 
                                                                           ( 
                                                     Radians(25.2097)) * 
                                                     Sin(Radians(map_latitude) 
                                                     )) ) AS distance 
                   FROM   `branches` 
                          INNER JOIN `bg_offer_branches` 
                                  ON `branches`.`id` = 
                                     `bg_offer_branches`.`branch_id` 
                   WHERE  `bg_offers`.`id` = `bg_offer_branches`.`bg_offer_id` 
                   HAVING `distance` <= 60000000 
                   ORDER  BY `distance` ASC);

本地输出
本地输出屏幕截图
产量
生产输出屏幕截图

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题