Query for splits

Phil Longstaff plongstaff at rogers.com
Sun Nov 12 14:20:44 EST 2006


I just want to verify what needs to be done.

When I open an account, the backend gets a QofQuery which translates
into SQL as:

	SELECT * FROM splits WHERE book.guid = "..." AND account.guid = "..."

I assume that what is really needed is:

	SELECT * FROM transactions
		WHERE guid IN (SELECT unique tx_guid FROM splits
						WHERE account_guid = "...")

This assumes that when a transaction is loaded, all of its splits are
loaded too.  When the transactions are created, they are put into the
engine.  The splits are created as children of the transactions.  The
set of splits matching the initial query are put into the query's result
set.

I haven't looked at the sorting in the initial query, so I don't know
how it would translate to a transaction SELECT

I guess I had better check that a transaction hasn't already been loaded
before I reload it.

Phil



More information about the gnucash-devel mailing list