Count Record Each Day Of A Month From Mysql Into Html Table
I'd like to put all mySql results in a html table. This is mySql: SELECT date(vwr_date) AS mon, date(vwr_date) AS date, count(vwr_cid) AS views FROM car_viewer WHERE Year(vwr_dat
Solution 1:
You can return data in that format from mysql
SELECT MONTH_v, YEAR_V
GROUP_CONCAT(IF(day_v=1, views, null)) AS '1',
GROUP_CONCAT(IF(day_v=2, views, null)) AS '2',
----
GROUP_CONCAT(IF(day_v=31, views, null)) AS '31'
FROM
(
SELECT DAY(vwr_date) AS day_v,
MONTH(vwr_date) AS MONTH_v,
Year(vwr_date) AS YEAR_V,
date(vwr_date) AS date_v,
count(vwr_cid) AS views
FROM car_viewer
WHERE Year(vwr_date)='2012' AND vwr_tid='18'
GROUP BY date_v
)
GROUP BY MONTH_v, YEAR_V
ORDER BY MONTH_v, YEAR_V DESC
Post a Comment for "Count Record Each Day Of A Month From Mysql Into Html Table"