SQL Auto-Increment by DateTime

auto-increment, datetime, mysql

Solution

Run this in your MySQL:

ALTER TABLE `mytable` 
CHANGE COLUMN `DateTime` `DateTime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ;

This sets your default value to `CURRENT_TIMESTAMP`.

Problem

Is there a way in my sql to auto increment by the date and time? so say I have a table ``` mytable ===================================================== = Comment_ID = First_Name = Comment = DateTime = ===================================================== = 1 = Bob = FooBar = 11-01-14 11:00 = = 2 = Jack = Blah = 11-01-14 12:29 = = 3 = John = jonny = 12-01-14 07:09 = ===================================================== ``` Is there away to make the date auto-increment?

Original source