| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Olaf Stein | Date: | September 4 2007 7:05pm |
| Subject: | Re: timestamp for update and insert | ||
| View as plain text | |||
I would use a trigger (at least for the update).... The first insert should work with now() and you can leave lastupdateted empty Olaf On 9/4/07 3:01 PM, "Hiep Nguyen" <hiep@stripped> wrote: > Hi list, > > i tried to create a table with inserted & lastupdated timestamp fields: > > create table temp ( > id int not null primary ke auto_increment, > data varchar(100), > inserted timestamp default now(), > lastupdated timestamp(8)); > > > how do i get mysql to put in the current timestamp for inserted & > lastupdated fields when i insert a record and only lastupdated when i > update the record? > > thanks, > T. Hiep >
| Thread | ||
|---|---|---|
| • timestamp for update and insert | Hiep Nguyen | 4 Sep |
| • Re: timestamp for update and insert | Olaf Stein | 4 Sep |
| • Re: timestamp for update and insert | Michael Dykman | 4 Sep |
| • Re: timestamp for update and insert | Olaf Stein | 4 Sep |
| • Re: timestamp for update and insert | Hiep Nguyen | 4 Sep |
| • Re: timestamp for update and insert | Michael Dykman | 4 Sep |
| • Re: timestamp for update and insert | Hiep Nguyen | 4 Sep |
| • Re: timestamp for update and insert | Olaf Stein | 4 Sep |
| • RE: timestamp for update and insert | Daevid Vincent | 4 Sep |
