Thank you Matthew! I realize now that it's a supported option, I just 
couldn't find it in the documentation 
<https://beancount.github.io/docs/beancount_query_language.html>.



On Sunday, November 13, 2022 at 5:07:31 AM UTC-8 matthew...@gmail.com wrote:

> There is no guarantee there will be only two accounts represented in a 
> transaction. So this may result in multiple "other account" entries 
> returned.
>
> Given your inputs above the query and result is possible with beanquery :
>
>     $ bean-query ./test.beancount 'select date, narration, account, 
> other_accounts, number, currency where account ~ ":Gas" and 
> joinstr(other_accounts) ~ "WellsFargo"' -f csv
>     date,narration,account,other_accounts,number,currency
>     2022-10-02,Gas WF,Expenses:Gas,Assets:WellsFargo:Checking,20,USD
>     2022-10-03,Gas WF,Expenses:Gas,Assets:WellsFargo:Checking,40,USD
>
> But if you have more complicated transactions with multiple expenses, 
> you'll also potentially end up with rows with multiple accounts like this:
>
>     
> 2022-07-26,GasAndEat,Expenses:Gas,"Expenses:Food,Assets:WellsFargo:Checking",26.99,USD
>
> On Saturday, November 12, 2022 at 5:19:52 PM UTC-5 Daniel González wrote:
>
>> Hi,
>>
>> I'm interested in querying an account for transactions made agains 
>> another account in particular. 
>>
>> For example let's say I have:
>>
>> 2022-10-01 * "Gas bofa"
>>   Assets:BofA:Checking
>>   Expenses:Gas          40 USD
>>
>> 2022-10-02 * "Gas WF"
>>   Assets:WellsFargo:Checking
>>   Expenses:Gas          20 USD
>>
>> 2022-10-03 * "Gas WF"
>>   Assets:WellsFargo:Checking
>>   Expenses:Gas          40 USD
>>
>> I would like to check my WF checking account for Gas expenses. This is, I 
>> would like to return only the last two transactions. 
>>
>> More generally, I would also like be able to see in a query the other 
>> account agains which this transaction was made. Something like:
>>
>> date,narration,account, counter-account (?), position (USD)
>> 2022-10-01,Gas bofa,Assets:BofA:Checking,Expenses:Gas,-40
>> 2022-10-02,Gas WF,Assets:WellsFargo:Checking,Expenses:Gas,-20
>> 2022-10-03,Gas WF,Assets:WellsFargo:Checking,Expenses:Gas,-40
>>
>> Is this possible?
>>
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/6328244d-08ec-47dc-b9c0-95a890a0a60cn%40googlegroups.com.

Reply via email to