Show sum of supplier purchases in a form
Posted: Sat Sep 23, 2017 5:51 am
Hi,
I want to have a textbox showing the sum of purchases for individual suppliers. I want to show this textbox in a "Manage Supplier" form. The amounts purchased are in a "T_Item" table, linked to a "T_Supplier" table with an "ID" field. Here is what I have:
SELECT SUM( "T_Item"."Cost" ) FROM "T_Item"
INNER JOIN "T_Supplier" ON "T_Item"."ID_Supplier" = "T_Supplier"."ID"
GROUP BY "T_Supplier"."ID"
This query shows the sum of all the purchases from all suppliers in the table, not just the "active" one on the form, i.e. every supplier shows the same total instead of each his own. What am I missing?
Thank you
I want to have a textbox showing the sum of purchases for individual suppliers. I want to show this textbox in a "Manage Supplier" form. The amounts purchased are in a "T_Item" table, linked to a "T_Supplier" table with an "ID" field. Here is what I have:
SELECT SUM( "T_Item"."Cost" ) FROM "T_Item"
INNER JOIN "T_Supplier" ON "T_Item"."ID_Supplier" = "T_Supplier"."ID"
GROUP BY "T_Supplier"."ID"
This query shows the sum of all the purchases from all suppliers in the table, not just the "active" one on the form, i.e. every supplier shows the same total instead of each his own. What am I missing?
Thank you