Beruflich Dokumente
Kultur Dokumente
Previous message: SQL unlimited depth recursive Chart of Accounts, postgres version
Next message: Writing custom reports for Customers
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
SQLite3 doesn't have lpad but both SQLite3 and postgres have substr and
they do the same thing so identical SQL can be used (I've stripped out
some casting to (hopefully) make the code more readable).
UNION ALL
SELECT a.guid
,a.parent_guid
,a.NAME
,tree.name_tree || ':' || a.NAME AS name_tree
,substr('.................................',1,depth*2)
http://lists.gnucash.org/pipermail/gnucash-user/2014-December/057344.html 25/11/2016
SQL unlimited depth recursive Chart of Accounts, postgres & sqlite3 version Page 2 sur 2
|| a.NAME AS name_tabs
,a.account_type
,depth + 1 AS depth
FROM tree
JOIN accounts a
ON tree.guid = a.parent_guid
)
SELECT *
FROM tree
ORDER BY name_tree ;
===
Caveats:
[2] don't let that put you off trying things out, this doesn't change
anything in your accounts
===
Presuming no-one tried this out before (I think postgres is the minority
backend) would you like to see a chart of accounts or balance sheet ?
--
Wm...
Previous message: SQL unlimited depth recursive Chart of Accounts, postgres version
Next message: Writing custom reports for Customers
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
http://lists.gnucash.org/pipermail/gnucash-user/2014-December/057344.html 25/11/2016