分组不在GCP中工作,但在Mysql数据库中执行相同的查询

时间:2018-03-13 11:59:01

标签: mysql sql database

此查询不使用Php在GCP中执行。相同查询在本地服务器中执行。 请建议我如何获得结果?

select sum(decl_count) as decl_count , sum(counts) as total  
    FROM 
        (select dates,max(version) as version, counts, decl_count 
    FROM
        (select version, count(declaration) as counts,
        count(case when declaration=1 then 1 else null end) as decl_count, 
        date(productiondate) as dates FROM table_name
        WHERE  edition='abc' and MONTH(productiondate) = MONTH(CURRENT_DATE())
        AND YEAR(productiondate) = YEAR(CURRENT_DATE())  
        GROUP BY version, date(productiondate) 
        ORDER BY version DESC ) AS temp 
        GROUP BY dates   ORDER BY dates DESC) as temp2

0 个答案:

没有答案