Alex Thurgood <[EMAIL PROTECTED]> wrote:
> Le lun 26/05/2003 ? 21:00, [EMAIL PROTECTED] a ?crit :
>
>> From: Victoria Reznichenko <[EMAIL PROTECTED]>
>> To: [EMAIL PROTECTED]
>> Subject: Re: Automatic calculation of date additions
>> Date: 26 May 2003 15:57:41 +0000
>>
>> Alex Thurgood <[EMAIL PROTECTED]> wrote:
>> >
>> > I'm just learning to get to grips with mysql, and I've been looking at
>> > the date functions. I want to be able to define a table that will take a
>> > starting date e.g. "action_date" and then use the value entered here to
>> > automatically calculate a second date to be inserted automatically into
>> > field "final_date" , using a third value taken from another field
>> > "time_limit" as the variable for the addition.
>> >
>> > I understand that statically this can be done using the INTERVAL
>> > function :
>> >
>> > action_date + INTERVAL 4 MONTH
>> >
>> > but I can't see how to replace this interval value with one from the
>> > field "time_limit" (defined as int) and insert the result into a second
>> > field "final_date". Can I do this in a create table statement or is that
>> > not possible ?
>>
>> No, you can specify this in CREATE TABLE statement, but you can use DATE and TIME
>> functions in the INSERT statement.
>>
>
> Ok, thanks, so something like :
> INSERT INTO office_action VALUES("","2003-04-24","","")
> INSERT INTO office_action VALUES(final_date) WHERE final_date =
> action_date + INTERVAL time_limit MONTH ??
>
> Would that work ?
Nope. At first in your case you get 2 rows. At second you can't use column in the
INTERVAL clause.
If you insert all values together, you should know value of time_limit. So just put
this value into INTERVAL clause.
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]