场景:我想进行一个查询,该查询可以返回来自同一列但条件不同的两个或多个字段,以便我可以计算数据。
SQL:
SELECT
FROM_UNIXTIME(news_date, '%Y-%m-%d') AS `DATE`,
COUNT(news_slant=1) AS `Neutral`,
COUNT(news_slant=2) AS `Positive`,
COUNT(news_slant=3) AS `Negative`
FROM tbl_news
GROUP BY `news_date`
ORDER BY `news_date`