at work I run mysql 3.23.45. on a windows2000 machine with apache 1.3.23
and php4.06. at home it's Linux SuSe *.0, mysql 4.03 apache 1.3.26 and
php4.2.3. the problem is I'm having problems inserting data into
temporary tables. the results are different running the same script.
here is the script (It's semi long so please bear with me).
$CreateTempTable=mysql_query("Create temporary table
Tmp (maintId int unique,
deptId varchar(30),
exhibitId VARCHAR(30),
datefinished date,
progressId VARCHAR(33),
reset int(1))");
//create temp table for all occurrences during dates specified
mysql_query("INSERT into Tmp
SELECT maintId,
deptId,
exhibitId,
datefinished,
progressId,
reset
from maintenance where DateReported>='$firstdate'
and DateReported<='$lastdate'");
// insert into temporary table date reported data
mysql_query("INSERT into Tmp
SELECT maintId,
deptId,
exhibitId,
datefinished,
progressId,
reset
from maintenance where DateFinished>='$firstdate'
and DateFinished<='$lastdate'");
// insert into temporary table date finished data
mysql_query("INSERT INTO Tmp
SELECT maintId,
deptId,
exhibitId,
datefinished,
progressId,
reset
from maintenance where DateReported<='$firstdate'
and DateFinished='0000-00-00'");
//insert into temporary table unfinished and previously started data
mysql_query("INSERT into Tmp
SELECT maintId,
deptId,
exhibitId,
datefinished,
progressId,
reset
from maintenance where DateReported<='$firstdate'
and DateFinished>='$lastdate'");
// insert into temporary table finished and previously started data
mysql_query("UPDATE Tmp set progressid='in progress'
where DateFinished>'$lastdate'");
//change database to show what was completed by lastdate
mysql_query("alter table Tmp add complete
tinyint default 0");
//added to be able to sum() complete
mysql_query("alter table Tmp add InProgress
tinyint default 0");
// added to be able to sum() InProgress
mysql_query("Alter table Tmp add parts
tinyint default 0");
//added to be able to sum() parts
mysql_query("ALTER TABLE Tmp add deferred
tinyint default 0");
//added to be able to sum() deferred
mysql_query("UPDATE Tmp set complete='1' where
progressId='complete'");
//changed to be able to sum()complete
mysql_query("UPDATE Tmp set InProgress='1'
where progressId='in progress'");
//changed to be able to sum()InProgress
mysql_query("UPDATE Tmp set parts='1'
where progressId='waiting for parts'");
//changed to be able to sum()Waiting for parts
mysql_query("UPDATE Tmp set deferred='1'
where progressId='deferred'");
//changed to be able to sum() deferred
$row=mysql_query("SELECT dept.name,
count(Tmp.deptId),
sum(complete),
sum(InProgress),
sum(parts),
sum(deferred),
sum(reset)/sum(complete) * 100,
sum(reset)/$days_result from Tmp, dept where
Tmp.deptId=dept.deptid
Group by dept.deptId order by dept.name");
// selecting departments by groups
if ($row==0)
die(mysql_error());
$totals=mysql_query("SELECT COUNT(deptId),sum(complete),
sum(InProgress),sum(parts),sum(deferred),
sum(reset)/sum(complete) * 100 ,sum(Tmp.reset)/$days_result
from
Tmp");
any thoughts on the duplicates? this gives runs fine on mysql 3.2.53 but
stops at duplivcate entries on 4.03.
John Coder
---------------------------------------------------------------------
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