On 03/07/25 17:58, Ken Mankoff wrote:
I'd like to list all transfers between two accounts. For example, to estimate monthly credit card payments.

I've tried,

bean-query bc.bean "SELECT date, payee, narration WHERE account ~ 'Assets:foo:bar' AND account ~ 'Liabilities:foo:baz'"

But it returns nothing (because account is one thing, and cannot be an AND of two things). Can someone help me with this query? I tried ChatGPT and it was not helpful.

The "modern" bean-query way to do this is:

SELECT
  date,
  payee,
  narration
FROM
  #postings
WHERE
  'Assets:Foo:Bar' IN entry.accounts AND
  'Liabilities:Foo:Baz' IN entry.accounts

The "old, discouraged, and deprecated" way to do it is:

SELECT
  date,
  payee,
  narration
WHERE
  has_account('Assets:Foo:Bar') AND
  has_account('Liabilities:Foo:Baz')

--
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/a7f129d8-e9c4-459f-ab2c-71fc00502b0a%40grinta.net.

Reply via email to