我有一个名为“pois”的表,我想运行 SQL 查询,它将显示 500 m 内距离手机 GPS 位置最近的所有位置,我将 MySQL 代码复制到某处并将其用于 SQLLite,但它不起作用,也许任何人都可以帮我将查询翻译成 SQLLite 查询版本?
代码如下:
Sub GPS_LocationChanged (Location1 As Location)
Loc1 = Location1.Latitude
Loc2 = Location1.Longitude
Dim Cursor As Cursor
Qry = "Select place_id,place_name,lat,lon,poi_catid, ( 6371 * acos( cos( radians( " & Loc1 & " ) ) * cos( radians( lat ) ) * cos( radians( lon ) - radians( " & Loc2 & ") ) + sin( radians( " & Loc1 & " ) ) * sin( radians( lat ) ) ) ) as distance FROM pois HAVING distance < 0.5 ORDER BY distance"
Cursor = SQL1.ExecQuery(Qry)
For i = 0 To 15
Cursor.Position = i
ToastMessageShow(Cursor.GetString("place_name"),True)
Next
Cursor.Close
End Sub
错误信息说:
android.database.sqlite.SQLiteException:没有这样的功能:acos(代码1):