GnuCash SQL Examples
From GnuCash
Revision as of 11:30, 14 March 2021 by MaestroGlanz (talk | contribs) (Created page with "== Introduction == == Request all child accounts of a given account == <syntaxhighlight lang="sql"> with recursive account_tree as ( select guid, parent_guid fro...")
Introduction
Request all child accounts of a given account
with recursive account_tree as (
select guid, parent_guid
from accounts
where guid = 'Start account' -- this defines the start of the recursion
union all
select child.guid,
child.parent_guid
from accounts as child
join account_tree as parent on parent.guid = child.parent_guid -- the se>
)
select * from account_tree;