Your Ad Here

Posted By

theroamingcoder on 10/05/09


Tagged

week group


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

MatthewOnline


MySQL group by week


 / Published in: SQL
 

Using MySQL you can group date data by week. This is much easier than trying to add up the daily values for each week in a code loop.

  1. SELECT join_date AS week, count(*) AS signups
  2. FROM users
  3. GROUP BY week(join_date);

Report this snippet  

You need to login to post a comment.