DECLARE @fromdt AS datetime DECLARE @todt AS datetime SET @fromdt = '7/1/2014' SET @todt = '7/31/2014' select * from tblOrgRegistrations as r JOIN tblOrgHours as h ON h.RegID = r.regid Where r.AgencyID = 74 And (h.ActivityDate >= @fromdt And h.ActivityDate <= @todt) Group By r.Agency
Msg 8120, Level 16, State 1, Line 5 Column 'tblOrgRegistrations.RegID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
23 Experts available now in Live!