Ms-access – Access Web App query 3 Tables with aggregatios – Need a workaround

aggregatedatabase-designjoin;ms access

I'm designing an Access 2016 Web App for inventoring our computers.

The problem I have is with a query where I want to get the CPUCore-amount and RAM-Amount for each PC.

GUI-Query

The computer-value in RAM and CPU are lookups on Computer.DNS
So in SQL it would be something like

SELECT Computer.DNS,SUM(CPU.Cores),SUM(RAM.Size) FROM Computer,CPU,RAM GROUP BY Computer.DNS 

The result from the GUI-Query aboth is

[Result2]

Both SUM coloumns are (for most PCs) wrong.

The formula it's using (which are wrong!):

Cores: COUNT(CPUs)       * realAmount

RAM  : COUNT(RAM-sticks) * realAmount

Can anybody show me why it's doing that and what I did wrong?

I tried using

Cores: Sum([CPU].[Cores]-Count([RAM].[Size]))

in the "Field"-field but I get the error "Cannot have aggregate function in expression"

Best Answer

I have one workaround going which is making a seperate query for each 1:n-relation which connects DNS and SUM(foo) and one query which has the results of all the queries. Then in the little ERM for the query I connect every DNS entry of the queries. For 1:1 relations in the DB I can just use the standard table in the overallQuery.

still looking for other workarounds though