I’ve written a query where I select the likes and the dislikes out of a column. I get the results but now I want to add a name to each of the grouped result, is this possible ?
Table structure:
id ,
snippet_id ,
user_id ,
kind
the query:
SELECT COUNT(v) as likes FROM Vote v GROUP BY v.kind
The result I get:
array(0 => 10, 1 => 3);
I want a result like this:
array(‘likes’ => 10, ‘dislikes’ => 3);
Add
v.kindto your field list:SELECT v.kind, COUNT(v) as likes FROM Vote v GROUP BY v.kind