Hi, I’m a very small business 1-man shop. I do my own development for myself (I’m a musician, not a developer)…I’m a bit of a noobie to SQL although I mostly have fun with database design, when I have the time. I tend to like the GUI vs SQL statements written up.
I’m stumped with this one. In my database I’m trying to build a query for a report utilizing 3 tables…
“accounts_receivable”
“clients”
“acctg_categories”
I want the client to be GROUP, the amount SUM, and the “categoryID” to be “0” to filter for a specific form of income. This is filtered with Date being a date range.
Everything works fine until I tell the “categoryID” to criterion “0”…here’s the SQL statement off the designer window:
Edit SQL by Ratslinger for easier read:
SELECT "clients"."client_name" AS "client",
SUM("accounts_receivable"."amount") AS "amount"
FROM "accounts_receivable",
"clients",
"acctg_categories"
WHERE "accounts_receivable"."clientID" = "clients"."clientID"
AND "accounts_receivable"."categoryID" = "acctg_categories"."categoryID"
AND "accounts_receivable"."Date" BETWEEN:Enter_Begin_Date AND:Enter_End_Date
AND "acctg_categories"."categoryID" = 0
GROUP BY "clients"."client_name"
ORDER BY "accounts_receivable"."client" ASC
Very hard for me to read; my apologies, as I get lost in the SQL statement itself. I didn’t type it; Libreoffice wrote it as I designed the Query in the GUI. What makes it harder is trying to understand what Libreoffice is telling me in the error.
The error is: Not in aggregate function or group by clause: org.hsqldb.Expression@1186c88
Using the “more” dialog button I get this:
SQL Status: 37000
Error code: -67
which then says what the error is and then pastes all the code in one big ugly paragraph.
What am I missing? I REALLY appreciate any help anyone can give.