Wednesday, July 16, 2008

SQL: CONCAT(), GROUP BY and DATE formatting

SELECT
(CONCAT( MONTH(date_time), "/", DAYOFMONTH(date_time) ,"/", YEAR(date_time))) as date,
COUNT(*) as visits
FROM metrics_session m 
GROUP BY YEAR(date_time), MONTH(date_time), DAYOFMONTH(date_time);



"Did you find this post useful? Sponsor marathon for cancer"