You are here: Re: Analyzing dates in a table « PHP Programming Language « IT news, forums, messages
Re: Analyzing dates in a table

Posted by ZeldorBlat on 09/08/05 01:13

First off, you probably can't use the word 'Date' as a column name.
Aside from that, it isn't too tough:

Hits today:

select sum(pageViews)
from tbl_hits
where Date = curdate()

Hits this week:

select sum(pageViews)
from tbl_hits
where weekofyear(Date) = weekofyear(curdate())
and year(Date) = year(curdate())

If you want to count total hits for some arbitrary interval:

select sum(pageViews)
from tbl_hits
where Date between '1/5/2005' and '7/16/2005'

And, if you want to see these broken out by each page, just add
'pageename' to the select list and add a 'group by pagename' at the end
of the query.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация