Select sql queries

60 views
Skip to first unread message

Richard Gott

unread,
Dec 27, 2017, 12:39:53 PM12/27/17
to Ledger
I use sqlite and R with ledger and recutils. One very popular package inR (sqldf) allowd for the use of sqlite sql statements. This makes querying very much easier as there is a coomon language across applications.

I have tried the select statement in ledger, so there is obviously the infrastructure but no manual.

For me, the ability to do something like this would be great:

SELECT balance (or reg ...)
FROM income expenses default all
IN my.ledger
FORMAT csv or tsv or PRINT
WHERE (date < 2017/12/25
AND date > 2016/12/25
AND code='mytag')
FLAT
ORDER BY 'date' ASC

I don't think i would need anything else much.

Great prpgramme

Richard

Martin Blais

unread,
Dec 27, 2017, 12:54:58 PM12/27/17
to ledger-cli
I've implemented this idea in Beancount.
You can reduce all this double-entry bookkeeping reporting stuff to filter & aggregations, but it won't work generically: unless you have just a single currency and no cost basis, the aggregator functions need to support special semantics for those--that's all that's needed.  If you have just one currency and no cost basis, you could in theory export to a spreadsheet / table / database and run those types of queries on it.




Richard

--

---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages