vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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"" <joao@curitibaonline.com.br> escreveu na mensagem news:20061011154757.886.qmail@lists.mysql.com... > 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 >> >> > > |
| |||
| 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 |
| |||
| 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 > > |
| |||
| 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. |
| ||||
| 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 |