Reputation:
I need to make a mySQL query to calculate some values.
essentially I want to select a single column from a table, I want to count how many of each values there are and then give that to the user.
So:
SELECT numeric_values FROM answerTable
IF numeric_values == '1.00' THEN new_variable1 ++
IF numeric_values == '2.00' THEN new_variable2 ++
IF numeric_values == '3.00' THEN new_variable3 ++
IF numeric_values == '4.00' THEN new_variable4 ++
RETURN new_variable1 ++
RETURN new_variable2 ++
RETURN THEN new_variable3 ++
RETURN THEN new_variable4 ++
;
I really havent got a clue where to start looking or if these types of operators are even available in mySQL?
Upvotes: 1
Views: 68
Reputation: 26784
SELECT numeric_values,COUNT(numeric_values)as name FROM answerTable
GROUP BY numeric_values
Upvotes: 2