Solved

# VB.net SQL Find the difference in two totals

Posted on 2014-08-02

Hi

I am using the following SQL query to calculate total scores in a SQL table for Survey 1

Once the second survey is complete I have to calculate the difference between the scores.

I could calculate total survey 2 scores by changing the following to have Survey = 2

How do I calculate the difference, Do I use data tables?

"Select [UserID],[Name],Sum([Gratitude]) as Sum_Gratitude, Sum([Reframing]) as Sum_Reframing, Sum([Empathy]) as Sum_Empathy, Sum([Adaptable]) as Sum_Adaptable, Sum([Teamwork]) As Sum_Teamwork From Diary2 Where CompanyID = 'ABC' And Survey = 1 Group By UserID, Name"