| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Michael T. Babcock | Date: | May 13 2004 2:15am |
| Subject: | Re: urban myth? | ||
| View as plain text | |||
Boyd E. Hemphill wrote: >To all who answered thank you. This answer below is the one that I can >use to convince him what he proposes is not necessarily safe. > > I almost always have a timestamp column immediately after my auto_increment'ed primary key column which I use for ordering by insert/update order. To get rows from oldest to most recent, I just: CREATE TableName ( ID smallint unsigned not null auto_increment primary key, MTime timestamp, Data ... ); SELECT * FROM TableName ORDER BY MTime ASC; If you want "created" order as well, you can do: CREATE TableName ( ID smallint unsigned not null auto_increment primary key, MTime timestamp, CTime timestamp, Data ... ); INSERT INTO TableName (CTime, Data) values (now(), ...), (now(), ...), ... That will give you an MTime that's auto-updated based on last modification and a CTime that is the creation timestamp. -- Michael T. Babcock http://mikebabcock.ca/
| Thread | ||
|---|---|---|
| • Create table results in (errno: 121) | Tom Brown | 22 Apr |
| • Re: Create table results in (errno: 121) | Martijn Tonies | 22 Apr |
| • Re: Create table results in (errno: 121) | Tom Brown | 22 Apr |
| • Re: Create table results in (errno: 121) | Adam | 28 Apr |
| • urban myth? | Boyd E. Hemphill | 3 May |
| • Re: urban myth? | Peter J Milanese | 3 May |
| • Re: urban myth? | Daniel Clark | 3 May |
| • Re: urban myth? | Garth Webb | 3 May |
| • Re: urban myth? | Bob Ramsey | 3 May |
| • Re: urban myth? | Josh Trutwin | 3 May |
| • Re: urban myth? | Garth Webb | 3 May |
| • Re: urban myth? | Michael Stassen | 3 May |
| • RE: urban myth? | Boyd E. Hemphill | 3 May |
| • Re: urban myth? | Anders Karlsson | 3 May |
| • Re: urban myth? | Michael T. Babcock | 13 May |
| • Re: urban myth? | Josh Trutwin | 3 May |
| • Re: urban myth? | Jeremy Zawodny | 3 May |
| • Re: urban myth? | gerald_clark | 3 May |
| • Re: urban myth? | Peter J Milanese | 3 May |
| • Re: Create table results in (errno: 121) | beacker | 22 Apr |
| • RE: urban myth? | Mike Johnson | 3 May |
| • Re: urban myth? | Udikarni | 3 May |
