My question might be OT for this thread, but it connects to the FROM/WHERE
topic.
How do I write a BQL query that selects transactions from certain accounts,
and excludes those transactions that have a posting that matches another
account? For example, select all transactions from Credit-Card:Bla:Bla that
don't have Assets:Transfer in the postings. I tried FROM accounts ~
'Credit-Card:Bla:Bla' and WHERE with Assets:Transfer, but I always get a
syntax error. (pseudocode, not the actual query...)

Thanks

Thanks,
Stefano

On Mon, Aug 22, 2022 at 2:18 PM Red S <[email protected]> wrote:

> On Wednesday, August 17, 2022 at 11:43:32 AM UTC-7 [email protected]
> wrote:
>
>> On 17/08/2022 07:00, Red S wrote:
>> > I would encourage you to go through the bql documentation, and
>> > specifically understand querying transactions vs. postings (FROM vs
>> > WHERE in bql terminology).
>>
>> The capability to use the FROM clause of a BQL query to filter ledger
>> entries is an unfortunate historical accident. There is no fundamental
>> difference between the expression that are used in the FROM clause and
>> in the WHERE clause, except for which table columns are accessible in
>> the two: the FROM clause has access only to columns derived from
>> transactions properties, while the WHERE clause has also access to
>> columns derived from posting properties:
>
>
> In this thread, the OP was using a transaction-level solution (tags), and
> perhaps executing or viewing the equivalent of "SELECT * FROM/WHERE
> YEAR=2022" which matches some tags. And ending up with postings from all
> sides of the transaction, leading to a balance sum of zero, which confused
> them. So at a higher level, I was pointing the OP to thinking about the
> distinction between transactions and postings, which seems to be a a
> not-uncommon stumbling block.
>
> But thanks for the context about FROM/WHERE and where that's headed. Makes
> sense, and removing FROM might also reduce a point of confusion, IMHO.
>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/beancount/05fba31f-ecc5-4ab2-91e3-2885dd09f4e8n%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/05fba31f-ecc5-4ab2-91e3-2885dd09f4e8n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/beancount/CAMzm8_r9q7_jBDa2MoAhBpB0OYwAFTcGxu%2BX4ore3HOpjofF8Q%40mail.gmail.com.

Reply via email to