Gerard Gilliland wrote:
Michael:
Again, Thank you for your excellent suggestions and quick response !!
I agree that "Two types of data means you should use two columns."
There is no excuse for bad design.
(I inherited the database and moved it to MySQL -- I should have converted
then.)
I
Name, Unit, TagName, CalDate, CalPeriod,
CalPeriodType,
(CalPeriod + Unit) AS CalNum
FROM tblTemp
WHERE (CalPeriod + Unit) > 7";
I do appreciate the thoroughness of your effort in coversion to Months,
However the potential for using Days looms ahe
Gerard Gilliland wrote:
Michael:
Thank you for your excellent suggestion and quick response.
You're welcome.
I now have an operable DATE_ADD.
The solution to break nPeriod into n and Period would not work directly.
That is, in the SELECT statement in the form of ...
$qry = "SELECT PlantName, Unit
quot;CREATE TABLE $tblName ($tblDef)"))
> die ('Cannot Create Table $tblName ' . mysql_error());
>
> // Table Data:
> if(!mysql_query("INSERT INTO $tblName VALUES(
> 'Valmont', '5', 'FCV96008', '2004-04-15', '1 Year')"))
> die ('Cannot Insert into $tblName ' . mysql_error());
> if(!mysql_query("INSERT INTO $tblName VALUES(
> 'Valmont', '5', 'FT0701', '2004-03-10', '3 Month')"))
> die ('Cannot Insert into $tblName ' . mysql_error());
>
>
Thread
Problem with DATE_ADD - Gerard Gilliland, July 16 2004 5:16am
Re: Problem with DATE_ADD - Michael Stassen, July 16 2004 7:48am
© 1995-2004 MySQL AB. All rights reserved.
MySQL.com Home Site Map Contact Us Privacy Policy Trademark Info
With DATE_ADD(date,INTERVAL expr type), date and expr can be dynamic, but
type must be literally one of the types in the list. It cannot come from a
column or function. It would be nice if it could, but it cannot.
One solution would be to break nperiod into n, an int, and period, a
char(x).
I need some help with a DATE_ADD problem.
I can't seem to run a query with DATE_ADD(date, INTERVAL expr type)
where expr and type are dynamic.
It works fine with date as dynamic.
I am attempting to add 1 year to 2004-04-15 for a DueDate of 2005-04-15
and add 3 months to 2004-03-10 for a DueDate of