techpr0
asked on
I need help with writing a select statement that totals a company survey answers.
I have the following table. where the data will only be 1,2 or 3.
name q1 q2 q3
Company 1 1 2 3
Company 1 1 3 1
Company 1 1 2 3
Company 2 2 2 3
Company 2 1 1 3
Company 3 3 2 3
Company 4 1 2 3
I need to run a query that will total the response grouped by Company. So It will return the following
name q1one q1two q1three q2one q2two q2three q3one q3two q3three
Company 1 3 0 0 0 2 1 1 0 2
Company 2 1 1 0 1 1 0 0 0 2
Company 3 0 0 1 0 1 0 0 0 1
Company 4 1 0 0 0 1 0 0 0 1
So basically I am summing up the results to know that company 1 entered 1 for column q1 3 times, 2 in column q1 0 times for company 1, 3 in column q1 0 times for company 1, and so on
name q1 q2 q3
Company 1 1 2 3
Company 1 1 3 1
Company 1 1 2 3
Company 2 2 2 3
Company 2 1 1 3
Company 3 3 2 3
Company 4 1 2 3
I need to run a query that will total the response grouped by Company. So It will return the following
name q1one q1two q1three q2one q2two q2three q3one q3two q3three
Company 1 3 0 0 0 2 1 1 0 2
Company 2 1 1 0 1 1 0 0 0 2
Company 3 0 0 1 0 1 0 0 0 1
Company 4 1 0 0 0 1 0 0 0 1
So basically I am summing up the results to know that company 1 entered 1 for column q1 3 times, 2 in column q1 0 times for company 1, 3 in column q1 0 times for company 1, and so on
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER