Difference between revisions of "GnuCash SQL Examples"

From GnuCash
Jump to: navigation, search
(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...")
(No difference)

Revision as of 11:30, 14 March 2021

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;