db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dag.wan...@oracle.com (Dag H. Wanvik)
Subject Re: New developer, need a little help with a subquery
Date Tue, 26 Jul 2011 12:43:36 GMT

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:
derby-user@db.apache.org. This list is intended for people that develop
Derby itself.

Conor66 <conor21eire@yahoo.ie> 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 

Mime
View raw message