大家好,我正在尝试实现原始sql查询,以便在django框架中创建api,输入参数是team_id、start_date和end_date。如team_id=1和start=2022-04-25和end_ date = 2022-05-01,temp1查询日期类似于7日期,从2022-04-25到2022-05-01。怎么做,请帮帮我。
我需要从查询集中排除一些结果。这样做的条件是,我想要排除排除特定对象列表的所有记录,但包括那些第二个值不是特定值的记录(即使记录belongs_to其中一个排除的记录)。我希望这能行得通:但是,当我在connection.queries中检查结果时,发现djangonot x in included_ids]我希望避免使用这种解决方案,因
我浪费了很多时间来撰写这样的查询。models.SmallIntegerField()
VIEWED = 0 DISLIKED = 2子查询是UserPostInteractions where status = LIKED) - (UserPostInteractions where status = DISLIKED) of Post(OuterRef('pk'))
查询是