SELECT
	"index" AS "id",
	"text" AS "name",
	ROW_NUMBER() OVER (ORDER BY "index") - 1 AS "index"
FROM text_data
WHERE category = 6 AND "index" BETWEEN 1000 AND 1999
	-- Exclude characters who have no succession relations defined.
	AND "index" IN (SELECT chara_id FROM succession_relation_member)
ORDER BY "id"
