MySQL从谷歌LineChart的TIMESTAMP列获得%的日期

时间:2014-02-25 12:27:44

标签: mysql sql

我基本上创建了一个社交网站,并建立了一个仪表板,向我展示网站上的各种信息。我想要一个折线图,显示大多数成员根据他们注册时指定的时间戳列中的日期加入的时间。我有点难过,因为我目前没有给我想要的结果,它给了我每个记录的日期和“pct”标签旁边的百分比

        SELECT DATE_FORMAT(joinedDate , "%d/%m/%Y"),COUNT(*) *
            t.factor AS pct
        FROM 
            first_reg
        JOIN (
        SELECT 100 / COUNT(*) AS factor
        FROM first_reg
        ) AS t
        GROUP BY
            joinedDate

提前致谢...

1 个答案:

答案 0 :(得分:0)

以下是答案

    SELECT COUNT(DATE(`joinedDate`)) AS `no_of_members_on_this_day`,
                                         DATE(`joinedDate`) AS `date_of_signup` 
                            FROM   tableName 
                            JOIN (
                                    SELECT 100 / COUNT(*) AS factor
                                    FROM tableName
                                  ) AS t
                            GROUP BY 
                                DATE(`joinedDate`)