I have next mysql table:
id | object_id | status
where object_id is not unique and status is tinyint(-1 or 1).
That is, for one object I can have several identical and / or different statuses.
I want to make SELECT query with getting object_id, COUNT of positive status (as pos) and COUNT of negative status(as neg) WHERE neg>pos;
I tried this, but i have problem with select several(vote_up and vote_down) columns from one(vote) using condition
SELECT * FROM (
SELECT object_id, COUNT(status) as (IF(status>0,'status_up','status_down'))
FROM object_statuses GROUP BY object_id;
) WHERE status_up<status_down;