I would like to do this:
select
                                                        DATEPART(wk, 
trn.TransactionDate) AS Week,
                                                        dtl.SectionID,
                                                        dtl.CategoryID,
                                                        sum(dtl.Hours) AS Hours,
                                                        sum(
                                                                case
                                                                        when 
dtl.Hours > 40 then dtl.Hours - 40
                                                                        else 0
                                                                end
                                                        ) AS Overtime,
                            year(trn.TransactionDate) AS Year
                                        from    dbo.law_tr_TransactionDetail dtl
                                                        inner join 
dbo.law_tr_Transaction trn ON trn.TransactionID =
dtl.TransactionID
                                                        inner join 
dbo.law_Badges bdg ON bdg.BadgeID = trn.BadgeID
                                                        inner join 
dbo.law_Districts dst ON dst.DistrictID =
bdg.DistrictID
                                        where
                                                        bdg.BadgeClassID = 1 and
                            trn.TransactionDate between '1/1/2008' AND
'12/31/2008'
                                        group by
                                                        dtl.CategoryID,
                                                        DATEPART(wk, 
trn.TransactionDate),
                            bdg.BadgeClassID,
                                                        dtl.SectionID,
                                                        
year(trn.TransactionDate)
ORDER BY DATEPART(wk, trn.TransactionDate),
                                                        dtl.SectionID,
                                                        dtl.CategoryID


Is something like this possible with ActiveRecord code?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to