db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor66 <conor21e...@yahoo.ie>
Subject Novice developer need a little help with a CASE statement
Date Thu, 04 Aug 2011 15:43:18 GMT

Hi guys, I hope someone out there can help me with this. I need to do a sum
function on what my case statement returns but I am encountering some
difficulty. The output.jpg might give a clearer outline of the issue. I need
to do a sum() on the "hours_diff" column. If anyone could assist me with
this I would be really grateful as I'm pretty new to SQL
http://old.nabble.com/file/p32195608/output.jpg 

SELECT  "U"."strFullName" AS "strUserName", (CASE when
"W"."dtmDateCompleted" > '2019-10-29 14:40:58.2'  THEN 
																								COALESCE(sum({fn TIMESTAMPDIFF(SQL_TSI_HOUR,
"dtmDateCreated", "dtmDateCompleted")}),0) 
																							when "W"."dtmDateCompleted" < '2019-10-29 14:40:58.2' 
THEN 
																								COALESCE(sum({fn TIMESTAMPDIFF(SQL_TSI_HOUR,
"dtmDateCreated", "dtmDateCompleted")}),0) end) as "hour_diff"
FROM "tblWorkOrder" "W" JOIN "tblUser" "U" ON ("W"."intRequestedByUserID" =
"U"."id")
GROUP BY "U"."strFullName", "W"."dtmDateCompleted" 
-- 
View this message in context: http://old.nabble.com/Novice-developer-need-a-little-help-with-a-CASE-statement-tp32195608p32195608.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message