I'm working on an ASP.NET 3.5 app that uses an MS SQL 2008 backend. The db has a couple of related tables: tblGoals and tblGoalsProgress. tblGoals currently has only three entries but the end user will have the ability to add additional goals,
if desired. Based on the three entries in tblGoals, I created the following query:
DECLARE @StartDate datetime, @EndDate datetime
SET @StartDate = '1/1/2010 12:00:00 AM'
SET @EndDate = '12/31/2010 12:00:00 AM'
SUM(CASE WHEN GoalsEffected = '1' THEN Rating ELSE 0 END) AS [Goal 1],
SUM(CASE WHEN GoalsEffected = '2'
View Complete Post