i was triyng for some days a way to do this using only MySQL (and not MySQL + PHP), but im not very good with SQL querys. The idea is this, my table (a short version):

Any time a user comes to my site a row is added to this table including the timedate of the visit and the type of visit (for this particular problem i only need type ‘profile_visit’. I need to feed a chart with the total visits made on the current week by day.
So, i need to retrive an array something like Mon(2) Tue(0) Wed(1) and so on. Do you think is possible to do this using just MySQL querys? Thanks for any help!
Instead of
you can also use
I tend to use
COUNTwhen it’s about counting, but that is merely a personal preference. There is no difference in terms of results returned by either method, and should be none either in terms of performance.The
OR NULLpart of theCOUNTexpression is explained here:UPDATE
For weeks starting on Monday try the following equivalent of the above script:
References:
DAYOFWEEK()(MySQL)WEEKDAY()(MySQL)