Haven't had a response yet, but this is how I achieved the desired result set of the expected data.
Below are the transactions for one of the items.

- CasilanTransactions.PNG (20.21 KiB) Viewed 3657 times
I then created a temporary table via pivot with the following script
Code: Select all
TRANSFORM Sum(transactions.[quantity]) AS SumOfquantity
SELECT items.item, transactions.[section]
FROM transactions INNER JOIN items ON transactions.item = items.id
GROUP BY items.item, transactions.[section]
PIVOT transactions.[transaction_type];
This produced the following:

- CasilianTransactionSummary.PNG (4.07 KiB) Viewed 3657 times
and called CT_itemsPerLocation
The query below was then applied
Code: Select all
SELECT CT_itemsPerLocation.item, sections.section, Nz([Incoming],0)-Nz([Outgoing],0)-Nz([Damaged],0)-Nz([Expired],0) AS Balance
FROM CT_itemsPerLocation INNER JOIN sections ON CT_itemsPerLocation.section = sections.id;

- ItemBalancePerLocation.PNG (3.24 KiB) Viewed 3657 times
NB - this was done via creating an ODBC with MS Access. I will attempt to do the same query in native MySQL.
How the end result can be displayed in AppGini, application side, not as a report, or even have the query created and displayed via AG would be appreciated.