hi 2 all ,
i have a problem in search according time period,

my table name "stats" have field id(int), ip(var char), counter(int),add_date(date time)

now i want a search on following ways

1. i want to show sum of counter according weekly >>>means weekly stats of counter
2. i want to show sum of counter according month>>> monthly stats of counter
3. i want to show sum of counter according yearly>>> yearly stats of counter

Member Avatar
diafol

Is the weekly set to one week since now (7 days) or is it since last Sunday?
I assume monthly means for this calendar month
I assume yearly means this calendar month

Do you want stats for this timespan or a list of all weeks if 'weekly', all months if monthly, etc etc.

Check out the 'BETWEEN' keyword in the mysql manual.

weekly mean only limited to this week and last week

monthly means stats according months for last 12 months,
stats for dec, month, stats for jan month, stats for nov month,

for yearly,, stats for this year , stats from last year