I am doing a report that sums hours for several employees, based on a
grouping per week. I want to find how much overtime is being spent.
So, I want 2 values, a sum of all time, and a sum of just the
overtime.
I was thinking of doing a case statement, like in SQL, but I'm not
sure how to do it in active record.
I currently have a query like this:
ClassificationRequest.Append(@"
select
trn.Week,
dtl.Section.ID,
dtl.Category.ID,
sum(dtl.Hours),
year(trn.Date)
from TransactionDetail dtl
inner join
dtl.Transaction trn
inner join trn.Badge bdg
inner join bdg.District
dst
where
bdg.Classification.ID =
:ID");
if (region > 0)
{
ClassificationRequest.Append(@"
and dst.Region.ID = :RegID
");
}
if (district > 0)
{
ClassificationRequest.Append(@"
and dst.ID = :DistID
");
}
ClassificationRequest.Append(@" and
trn.Date between :start AND :end
group by
dtl.Category.ID,
trn.Week,
bdg.Classification.ID,
dtl.Section.ID,
trn.Date
");
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---