MySQL Group by - Get columns with zero count

后端 未结 3 1914
一生所求
一生所求 2021-01-14 03:29

I tried decrying other answers, no luck, hence asking.

I have one table and few more similar to this for other year Here is the table structure

--         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 04:06

    You can nest a query, and search for when the Count is equal or greater than zero:

    SELECT a.status, a.stat_count FROM (SELECT status, count(*) as stat_count FROM table where company like '%Google%' GROUP BY status) a WHERE a.stat_count >= 0

提交回复
热议问题