0

我有一些问题

  1. 如何在乌龟 orm 中添加公式?例如像这样
select 
l.*,
111.045 * DEGREES(ACOS(COS(RADIANS(-123.343431))
* COS(RADIANS(latitude))
* COS(RADIANS(12423424}) - RADIANS(longitude))
+ SIN(RADIANS(-123.343431))
* SIN(RADIANS(latitude)))) AS distance
from location;
  1. 如何在选择中添加查询?查询没有关系的地方,例如这样
select 
"posts".*,
(
 select count(*)
  from "reactions"
 where "reactions"."object_id" = "posts".id
 AND reaction = TRUE
) as total,
from posts

我用的是龟版 0.17.8

谢谢你

4

0 回答 0