Have a look at

http://db.apache.org/derby/docs/10.8/ref/rrefsqlj32654.html

"GROUP BY" and perhaps "ROLLUP" for computing sub-totals.

Hope this helps,

Dag

Btw, such questions belong on the user list:
[email protected]. This list is intended for people that develop
Derby itself.

Conor66 <[email protected]> writes:

> Hi everyone. Ive recently started using apache derby. Im a recent graduate
> and I have a question for you more experienced developers out there. I would
> be grateful with any help on this. I want to make the two following queries
> into one, but the count(*) is giving me alot of trouble. They both work fine
> as individual queries. I want to see the - Number of work orders closed per
> day, by category. Any help on this would be amazing, I'm really stuck
>
> SELECT "W"."id" as "Work Order Id", "AC"."id", "A"."strName" AS "Category",
> day("dtmDateCompleted") as "Day"
> FROM "tblAssetCategory" "AC" inner join "tblAsset" "A" ON ("AC"."id" =
> "A"."intCategoryID")
> INNER JOIN  "tblWorkOrder" "W" ON ("W"."intAssetID" = "A"."id")
>
> SELECT day("dtmDateCompleted") AS "Day", count(*) AS "Count"
> FROM "tblWorkOrder"
> WHERE "dtmDateCompleted" IS NOT NULL 

Reply via email to