假设我想从第一个表到第二个表,通过总结值列,其中b是相等的,但也保持一个列。我将如何在SQLite中执行此操作。
SQLite不支持窗口函数,因此相关子查询是一种非常简单的方法:
select t.*, (select sum(t2.value) from t t2 where t2.b = t.b) as sumb from t;