gpt4 book ai didi

ios - 在 SQLite 中对 RatingColumn 求和

转载 作者:行者123 更新时间:2023-11-28 22:08:32 25 4
gpt4 key购买 nike

我有一个 SQLite 表,其中包含如下所述的列,

Table1
ID, Topics, Rating, Comments
1 topic1 3 none
2 topic1 4 none
3 topic2 2 none
4 topic2 4 none

我想使用 sqlite 查询为所有主题 1、主题 2 添加评级列。这个sqlite查询是怎么形成的?

谢谢。

最佳答案

您可以使用SUM() aggregate function为了实现这一目标。

你可以这样做:

SELECT SUM(Rating) from Table1 WHERE Topics="topic1";

关于ios - 在 SQLite 中对 RatingColumn 求和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23422244/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com