Time diference
| From: | Clever | Date: | Thu, 04 Apr 2002 02:36:27 +0000 |
| Subject: | Time diference | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18225@lists.php.net to get a copy of this message | ||
Hi,
I need to build a piece of code do calculate the total working time of a
employee.
I have the tables:
#
# Table structure for table 'card_ticks'
#
CREATE TABLE card_ticks (
cod bigint(20) unsigned NOT NULL auto_increment,
tick datetime ,
employee int(10) unsigned NOT NULL DEFAULT '0' ,
PRIMARY KEY (Cod)
);
#
# Table structure for table 'employes'
#
CREATE TABLE employes (
cod int(3) unsigned NOT NULL auto_increment,
nameme char(30) NOT NULL DEFAULT '' ,
pass char(50) NOT NULL DEFAULT '' ,
PRIMARY KEY (cod)
);
The table card_ticks is "feeded" by a system connected to a serial port
where each time the employee pass a card into a machine a record is inserted
on the table.
Generally, a employee has 4 card_tick's by day, for example
1,2002-04-02 23:51:48,3
2,2002-04-02 23:52:00,7
3,2002-04-02 23:52:09,5
4,2002-04-02 23:52:14,3
5,2002-04-02 23:52:23,8
6,2002-04-02 23:52:32,1
7,2002-04-02 23:52:40,3
8,2002-04-03 00:04:39,3
9,2002-04-03 00:08:45,3
10,2002-04-03 00:11:23,3
11,2002-04-03 00:20:26,3
I have to write the code to do something like this
Calculate the total working time in a month for employee 3.
Any sugestions?