Defaults can only be constants.
You might want to look at timestamp.
The first timestamp field in a row gets updated every time teh record
changes.
All other timestamps in a row only get updated automatically on insert.
Jamie S Buchanan wrote:
>
> Hello all,
> I'm a third year uni student in Scotland doing a year long project which
> involves a fair amount of MySQL. I have the following problem and would be
> appreciative if I could get some advice on solving it:
>
> - in the script I run to create a table how do I code one DateTime field
> to intially be set to a value of another DateTime field?
>
> More specifically, I have two DateTime fields (A and B), in my creation
> script I want to set the default value of B to the value of A so that
> when I write a new record to the table the position of B can be left
> NULL, or equivalent, but the value of A will be stored in it's place. I
> later on want to change B independently to a different value than A so I
> don't want a strict contraint that they must always be the same.
>
> Thanks,
> Jamie.
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
><[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php