DECLARE @fromdt AS datetime
DECLARE @todt AS datetime
SET @fromdt = '12/1/2014'
SET @todt = '12/31/2014'
SELECT p.Agency, count(distinct h.RegID)
FROM tblOrgProfile as p
LEFT JOIN tblOrgRegistrations as r
ON p.AgencyID = r.AgencyID
AND r.Volunteer = 1
LEFT JOIN tblOrgHours as h
ON h.RegID = r.regid
AND h.ActivityDate >= @fromdt
AND h.ActivityDate <= @todt
AND h.Hours > 0
AND h.VolunteerHour = 1
WHERE p.CSWGroup = 1
GROUP BY p.Agency
ORDER BY p.Agency
SELECT P.Agency, CA.LinkageName FROM tblOrgProfile P CROSS APPLY (SELECT
STUFF((SELECT '; ' + L.LinkageName
FROM tblOrgMonthlyReport M
JOIN tblOrgMonthlyLinkages L ON M.MonthlyID = L.MonthlyID
Where P.AgencyID = m.AgencyID
FOR XML PATH (''))
, 1, 1, '')
, STUFF((SELECT '; ' + L.Linkage
FROM tblOrgMonthlyReport M
JOIN tblOrgMonthlyLinkages L ON M.MonthlyID = L.MonthlyID
Where P.AgencyID = m.AgencyID
FOR XML PATH ('')), 1, 1, '')) CA (LinkageName, Linkage) where P.CSWGroup = 1
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE