SQL语句挑选数据值:
SELECT COUNT(table_new.c) AS `totalCount` FROM
(SELECT
`deviceId` AS `hotspot.deviceId`,
COUNT(`count`) AS `c`
FROM
`t_hotspot_log`
WHERE `sceneId` = 2
AND `deleted` = 0
AND `createdTime` >= "2017-01-01 00:00:00"
AND `createdTime` <= "2017-08-02 10:00:00"
GROUP BY `deviceId`)table_new
其中,挑选出的数据如下图所示:
执行完上述整体sql语句后统计的totalCount如下图所示: