vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 <joao@curitibaonline.com.br> 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" <ed@homes2see.com> escreveu na mensagem news:Pine.LNX.4.44.0610111201370.18226-100000@debian.homes2see.com... > > 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/mysql?unsub=redwards@swmx.com |
| |||
| 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 =' |
| ||||
| 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 <ed@homes2see.com> To: Rolando Edwards <redwards@swmx.com> Cc: João Cândido de Souza Neto <joao@curitibaonline.com.br>, 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 =' |
| Thread Tools | |
| Display Modes | |
|
|