如何在mysql MIN()聚合函数中比较科学计数法和小数?
我如何将 mysql MIN() 应用于混合十进制值和科学记数法值。我需要在 mysql 查询中使用 MIN() 使用纬度经度方程获得最小距离。如果距离是小数,则有效。但如果某个距离太小,如“5.89872212195226e-05”,则它无法正常工作。
问题是 mysql 查询中的 MIN(4,5.89872212195226e-05) 将始终返回“4”。
这是查询的部分
MIN (
(acos(sin((".$searchLat."*pi()/180)) *
sin((b_loc.locLatitude*pi()/180))+cos((".$searchLat."*pi()/180)) *
cos((b_loc.locLatitude*pi()/180))
* cos(((".$searchlng."- b_loc.locLongitude)*pi()/180))))*180/pi())*60*1.1515
) as mindistance
有解决方案吗?谢谢
How can i apply mysql MIN() over mixed decimal value and scientific notation values. I need to get minimum distance using latitude longitude equation in a mysql query with MIN(). It is working if the distance are decimal. But it is not working properly, if some distance are too small like "5.89872212195226e-05"
The problem is MIN(4,5.89872212195226e-05) in a mysql query will always return '4'.
Here is the part of query
MIN (
(acos(sin((".$searchLat."*pi()/180)) *
sin((b_loc.locLatitude*pi()/180))+cos((".$searchLat."*pi()/180)) *
cos((b_loc.locLatitude*pi()/180))
* cos(((".$searchlng."- b_loc.locLongitude)*pi()/180))))*180/pi())*60*1.1515
) as mindistance
Any solution? Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
转换为十进制应该有帮助:-
比较示例:-
用法示例:-
Cast to decimal should help :-
Example of comparison :-
Example usage :-