java - 如何在android的sqlite查询中使用sqrt函数
问题描述
我有这个代码:
// select all venues where distance to theme is less than 1km
@Query("SELECT * FROM Venue WHERE SQRT(((lat-:lat)*(lat-:lat))+((lng-:lng)*(lng-:lng)))<1000.0 ORDER BY distance LIMIT 30 OFFSET :offset")
fun getVenues(lat: Double, lng: Double, offset: Int): Flow<List<Venue>>
但我面临这个错误:
2021-02-23 00:38:51.419 30376-30510 E/SQLiteLog: (1) no such function: SQRT
在 android sqlite 中使用 SQRT 我应该怎么做?
解决方案
让它平方lat*lat+lon*lon < 1000000.0
(1000 * 1000)
推荐阅读
- r - 变量类是 data.table 中的列表
- java - 检查字符是否包含在字母列表中
- r - 如何从 R Google Colaboratory 写入文件?
- android - Android 的语音识别器 API
- angular - TypeError:无法在“FormData”参数2上执行“附加”不是“Blob”类型
- aurelia - 有没有办法使用 aurelia-mask 验证 Aurelia 中的 IPv4 地址范围和掩码值?
- rest - Huobi REST API - 签名请求 - 验证失败
- matlab - MATLAB - 编译 jpeg_read.c 以创建 mexmaci64 文件时出错
- python - 如何获取不在模式 grep 中的所有内容
- javascript - React / ES6 Onscroll功能未在Y方向触发