SELECT
"Filtered Gift Master"."Client" AS 'Client',
"Match"."Match Amount" AS 'Match Amount',
IF(SUM("Filtered Gift Master"."Amount") >= "Match"."Match Amount", SUM("Filtered Gift Master"."Amount") + "Match"."Match Amount", SUM("Filtered Gift Master"."Amount")) AS 'Income After Match'
FROM "Filtered Gift Master"
JOIN "Match" ON "Match"."Client" = "Filtered Gift Master"."Client"
WHERE "Filtered Gift Master"."Status" = 'Approved'
GROUP BY "Filtered Gift Master"."Client"
The design of the tables are as follows:
Filter Gift Master - Transaction ID, Amount, Client
Match - Match Amount, Client
It is giving me the following error:
Query Error: Improper usage of GROUP BY clause.
Please ensure that all non-aggregate columns used in the SELECT clause are also used in GROUP BY clause.
Any suggestions? Seems like a pretty straight forward query.