Re: date_add function

2006-10-11 Thread Rolando Edwards
Our pleasure. Good day !!!

- Original Message -
From: Ed Curtis <[EMAIL PROTECTED]>
To: Rolando Edwards <[EMAIL PROTECTED]>
Cc: João Cândido de Souza Neto <[EMAIL PROTECTED]>, mysql@lists.mysql.com
Sent: Wednesday, October 11, 2006 12:48:29 PM GMT-0500 US/Eastern
Subject: Re: date_add function


On Wed, 11 Oct 2006, Rolando Edwards wrote:

> Oops, also the $this_date
>
> UPDATE this_table SET
> this_date = '$this_date',
> future_date = DATE_ADD('$this_date',INTERVAL 90 DAY);

 Got it going guys, thanks again

Ed



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Mark Leith

Ed Curtis wrote:

UPDATE this_table SET
this_date = NOW(),
future_date = NOW() + INTERVAL 90 DAY;

This is probably along the lines of what you want..



 Actually I'm setting the DATE via drop down menus using PHP and creating
the date by hand via variables. NOW() won't work in this instance.
  


UPDATE this_table SET
this_date = '$this_date',
future_date = '$this_date' + INTERVAL 90 DAY;

Same thing still applies really.. And quote your dates...

Cheers,

Mark

--
Mark Leith, Support Engineer
MySQL AB, Worcester, England, www.mysql.com
Are you MySQL certified?  www.mysql.com/certification


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Ed Curtis

On Wed, 11 Oct 2006, Rolando Edwards wrote:

> Oops, also the $this_date
>
> UPDATE this_table SET
> this_date = '$this_date',
> future_date = DATE_ADD('$this_date',INTERVAL 90 DAY);

 Got it going guys, thanks again

Ed



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Rolando Edwards
Oops, also the $this_date

UPDATE this_table SET
this_date = '$this_date',
future_date = DATE_ADD('$this_date',INTERVAL 90 DAY);


- Original Message -
From: Rolando Edwards <[EMAIL PROTECTED]>
To: Ed Curtis <[EMAIL PROTECTED]>
Cc: João Cândido de Souza Neto <[EMAIL PROTECTED]>, mysql@lists.mysql.com
Sent: Wednesday, October 11, 2006 12:15:16 PM GMT-0500 US/Eastern
Subject: Re: date_add function

Please put the 2008-10-20 in single quotes
if you r are doing this in PHP

UPDATE this_table SET
this_date = $this_date,
future_date = DATE_ADD('$this_date',INTERVAL 90 DAY);

- Original Message -
From: Ed Curtis <[EMAIL PROTECTED]>
To: Rolando Edwards <[EMAIL PROTECTED]>
Cc: João Cândido de Souza Neto <[EMAIL PROTECTED]>, mysql@lists.mysql.com
Sent: Wednesday, October 11, 2006 12:43:00 PM GMT-0500 US/Eastern
Subject: Re: date_add function


On Wed, 11 Oct 2006, Rolando Edwards wrote:

> Please check your syntax.
> It should look like this:
>
> UPDATE this_table SET
> this_date = $this_date,
> future_date = DATE_ADD($this_date,INTERVAL 90 DAY);
>
> Don't forget your WHERE clause or else you populate every row.

 Tried it, this is what I get back.

You have an error in your SQL syntax near 'future_date =
date_add(2008-10-20, INTERVAL 90 DAY) WHERE id ='



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Rolando Edwards
Please put the 2008-10-20 in single quotes
if you r are doing this in PHP

UPDATE this_table SET
this_date = $this_date,
future_date = DATE_ADD('$this_date',INTERVAL 90 DAY);

- Original Message -
From: Ed Curtis <[EMAIL PROTECTED]>
To: Rolando Edwards <[EMAIL PROTECTED]>
Cc: João Cândido de Souza Neto <[EMAIL PROTECTED]>, mysql@lists.mysql.com
Sent: Wednesday, October 11, 2006 12:43:00 PM GMT-0500 US/Eastern
Subject: Re: date_add function


On Wed, 11 Oct 2006, Rolando Edwards wrote:

> Please check your syntax.
> It should look like this:
>
> UPDATE this_table SET
> this_date = $this_date,
> future_date = DATE_ADD($this_date,INTERVAL 90 DAY);
>
> Don't forget your WHERE clause or else you populate every row.

 Tried it, this is what I get back.

You have an error in your SQL syntax near 'future_date =
date_add(2008-10-20, INTERVAL 90 DAY) WHERE id ='



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Ed Curtis

On Wed, 11 Oct 2006, Rolando Edwards wrote:

> Please check your syntax.
> It should look like this:
>
> UPDATE this_table SET
> this_date = $this_date,
> future_date = DATE_ADD($this_date,INTERVAL 90 DAY);
>
> Don't forget your WHERE clause or else you populate every row.

 Tried it, this is what I get back.

You have an error in your SQL syntax near 'future_date =
date_add(2008-10-20, INTERVAL 90 DAY) WHERE id ='


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Ed Curtis


On Wed, 11 Oct 2006, Mark Leith wrote:

> Ed Curtis wrote:
> > I'm having some trouble setting a future date within a table. I have one
> > column 'this_date' which is a DATE field and I'm trying to add 90 days to
> > it and set a column named 'future_date', also a DATE field.
> >
> > I don't know if the problem is that I'm trying to write the value into
> > the 'this_date' and 'future_date' fields in the same query.
> >
> > UPDATE this_table SET
> > this_date = $this_date,
> > future_date = (DATE_ADD(this_date) INTERVAL 90 DAY)
> >
> >
> > Would this work?
> >
> > Thanks,
> >
> > Ed
> >
> >
> >
> >
> UPDATE this_table SET
> this_date = NOW(),
> future_date = NOW() + INTERVAL 90 DAY;
>
> This is probably along the lines of what you want..

 Actually I'm setting the DATE via drop down menus using PHP and creating
the date by hand via variables. NOW() won't work in this instance.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Rolando Edwards
Please check your syntax.
It should look like this:

UPDATE this_table SET
this_date = $this_date,
future_date = DATE_ADD($this_date,INTERVAL 90 DAY);

Don't forget your WHERE clause or else you populate every row.

- Original Message -
From: João Cândido de Souza Neto <[EMAIL PROTECTED]>
To: mysql@lists.mysql.com
Sent: Wednesday, October 11, 2006 11:50:17 AM GMT-0500 US/Eastern
Subject: Re: date_add function

Why you don�t try this?


UPDATE this_table SET
this_date = $this_date,
future_date = (DATE_ADD($this_date) INTERVAL 90 DAY)


"Ed Curtis" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
>
> I'm having some trouble setting a future date within a table. I have one
> column 'this_date' which is a DATE field and I'm trying to add 90 days to
> it and set a column named 'future_date', also a DATE field.
>
> I don't know if the problem is that I'm trying to write the value into
> the 'this_date' and 'future_date' fields in the same query.
>
> UPDATE this_table SET
> this_date = $this_date,
> future_date = (DATE_ADD(this_date) INTERVAL 90 DAY)
>
>
> Would this work?
>
> Thanks,
>
> Ed
>
> 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Jo�o C�ndido de Souza Neto
Your sql has more error.

I´ll put the right way below.

UPDATE this_table SET
this_date = $this_date,
future_date = DATE_ADD($this_date, INTERVAL 90 DAY)

It´ll works fine.


""João Cândido de Souza Neto"" <[EMAIL PROTECTED]> escreveu na 
mensagem news:[EMAIL PROTECTED]
> Why you don´t try this?
>
>
> UPDATE this_table SET
> this_date = $this_date,
> future_date = (DATE_ADD($this_date) INTERVAL 90 DAY)
>
>
> "Ed Curtis" <[EMAIL PROTECTED]> escreveu na mensagem 
> news:[EMAIL PROTECTED]
>>
>> I'm having some trouble setting a future date within a table. I have one
>> column 'this_date' which is a DATE field and I'm trying to add 90 days to
>> it and set a column named 'future_date', also a DATE field.
>>
>> I don't know if the problem is that I'm trying to write the value into
>> the 'this_date' and 'future_date' fields in the same query.
>>
>> UPDATE this_table SET
>> this_date = $this_date,
>> future_date = (DATE_ADD(this_date) INTERVAL 90 DAY)
>>
>>
>> Would this work?
>>
>> Thanks,
>>
>> Ed
>>
>>
>
> 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Jo�o C�ndido de Souza Neto
Why you don´t try this?


UPDATE this_table SET
this_date = $this_date,
future_date = (DATE_ADD($this_date) INTERVAL 90 DAY)


"Ed Curtis" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
>
> I'm having some trouble setting a future date within a table. I have one
> column 'this_date' which is a DATE field and I'm trying to add 90 days to
> it and set a column named 'future_date', also a DATE field.
>
> I don't know if the problem is that I'm trying to write the value into
> the 'this_date' and 'future_date' fields in the same query.
>
> UPDATE this_table SET
> this_date = $this_date,
> future_date = (DATE_ADD(this_date) INTERVAL 90 DAY)
>
>
> Would this work?
>
> Thanks,
>
> Ed
>
> 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: date_add function

2006-10-11 Thread Mark Leith

Ed Curtis wrote:

I'm having some trouble setting a future date within a table. I have one
column 'this_date' which is a DATE field and I'm trying to add 90 days to
it and set a column named 'future_date', also a DATE field.

I don't know if the problem is that I'm trying to write the value into
the 'this_date' and 'future_date' fields in the same query.

UPDATE this_table SET
this_date = $this_date,
future_date = (DATE_ADD(this_date) INTERVAL 90 DAY)


Would this work?

Thanks,

Ed



  

UPDATE this_table SET
this_date = NOW(),
future_date = NOW() + INTERVAL 90 DAY;

This is probably along the lines of what you want..

Cheers,

Mark

--
Mark Leith, Support Engineer
MySQL AB, Worcester, England, www.mysql.com
Are you MySQL certified?  www.mysql.com/certification


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



date_add function

2006-10-11 Thread Ed Curtis

I'm having some trouble setting a future date within a table. I have one
column 'this_date' which is a DATE field and I'm trying to add 90 days to
it and set a column named 'future_date', also a DATE field.

I don't know if the problem is that I'm trying to write the value into
the 'this_date' and 'future_date' fields in the same query.

UPDATE this_table SET
this_date = $this_date,
future_date = (DATE_ADD(this_date) INTERVAL 90 DAY)


Would this work?

Thanks,

Ed



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



date_add function

2002-10-08 Thread Dermot Paikkos

Hi 
I hope I am not being lazy here. I want to use the SQL date_add 
function on a value from one of my column values but I can't seem to 
figure out the syntax. 

This works:
select "2002-10-08 09:35:10" + interval 7 hour;

but how do I change "2002-10-08 09:35:10" to current_date or feed 
the values from one (or 2) fields. Ideally I just want the return the 
time +7 hours. 

What would also help out is if someone can explain if there is a 
general rule for using literal strings and column values?

Thanx.
Dp. 
~~
Dermot Paikkos * [EMAIL PROTECTED]
Network Administrator @ Science Photo Library
Phone: 0207 432 1100 * Fax: 0207 286 8668


-
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