私はsqliteで実行中の合計を取得しようとしています。今私は持っています:
SELECT
type,
count,
SUM(count) as startIndex
FROM
(
SELECT
things.type,
COUNT(things.name) as count
FROM
things
INNER JOIN thingGroups
ON thingID = things.id
INNER JOIN groups
ON groups.id=thingGroups.groupID
WHERE
groups.name='Space'
GROUP BY things.type
ORDER BY type
)
GROUP BY type, count
これは私に与えます:
Name A, 2, 2
Name B, 3, 3
Name C, 3, 3
を探しています:
Name A, 2, 0
Name B, 3, 2
Name C, 3, 5