Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TIMESTAMP output

Status
Not open for further replies.

JamesGMills

Programmer
Aug 15, 2005
157
GB
Hi everyone.

I am developing a tracking system. Every hit is recorded in a database with reference to the section and article that was hit. It also addds a TIMESTAMP to this record.

I would now like to show a report showing how many hits there have been per month.

I have no idea how to do this using the TIMESTAMP in mysql.

SELECT COUNT(*) FROM tracker WHERE dateTime ??

I need to group the hits together so that i only display months and years that there is actually data for too.

Any ideas?

Thanks
 
dateTime" isn't the name of your actual table column, is it? "DATETIME" is a MySQL reserved word, and as such should not be used as the name of a table column.



As to your actual question, I would use MySQL's month() and year() functions in my select (see

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Right well i better change my column name then, i did not think that it would matter what i called it? I have never had problems in the past?

I will take a look at the link you pointed me to...

Thanks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top