List:General Discussion« Previous MessageNext Message »
From:James Tu Date:November 10 2006 9:59pm
Subject:Using MySQL to log and report transactions
View as plain text  
Hi:

I'm going use MySQL to log transactions so that I can report on them  
later.
Ex:

CREATE TABLE statistics (
        id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT
      , user_id BIGINT UNSIGNED
      , entity_id INT UNSIGNED
      , transaction_type INTEGER(2) UNSIGNED
      , datetime_logged DATETIME
      , datetime_logged_gmt DATETIME
      , PRIMARY KEY (id)
);


What are the queries that would get me the data organized by:
Months
Weeks
Days
Day of Week?


I guess I can add the fields:
month
day
year
hour
dayofyear

and that would make reporting a lot easier!


How do people typically go about doing this without breaking down the  
datetime?

-James
Thread
Using MySQL to log and report transactionsJames Tu10 Nov
  • Re: Using MySQL to log and report transactionsDan Nelson10 Nov