Loading...

derby-dev@db.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

New developer, need a little help with a subquery Conor66 Mon Jul 25 22:01:53 2011

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 

-- 
View this message in context: 
http://old.nabble.com/New-developer%2C-need-a-little-help-with-a-subquery-tp32136886p32136886.html
Sent from the Apache Derby Developers mailing list archive at Nabble.com.