SQL Statement works fine with PHPMyadmin or mysqli->query
create table mytable SELECT timeheader.Project, CONCAT('$',timeheader.Expenses) As Expenses, DATE_FORMAT(timedetail.RowDate,'%d/%m/%Y') AS Datum,SEC_TO_TIME(SUM( TIME_TO_SEC( timedetail.Duration ))) AS Hours, CONCAT('$',FORMAT(timeheader.Intern_Rate,2,'en_US')) as 'Intern per Hour', CONCAT('$',FORMAT(SUM( TIME_TO_SEC( timedetail.Duration ))/3600timeheader.Intern_Rate,2,'en_US')) AS 'Internal Cost', CONCAT('$',FORMAT(timeheader.Extern_Rate,2,'en_US')) as 'Extern per Hour', CONCAT('$',FORMAT(SUM( TIME_TO_SEC( timedetail.Duration ))/3600timeheader.Extern_Rate,2,'en_US')) AS 'Extern Cost', CONCAT('$',FORMAT(125,2,'en_US')) as 'Billable per Hour', CONCAT('$',FORMAT((SUM( TIME_TO_SEC( timedetail.Duration ))*(125/3600))+timeheader.Expenses,2,'en_US')) AS 'Billable' FROM timedetail LEFT JOIN timeheader ON timedetail.Identifyer = timeheader.Identifyer group by timeheader.Identifyer, timeheader.Project, timeheader.Intern_Rate, timeheader.Extern_Rate, timeheader.Expenses, timedetail.RowDate order by timeheader.Identifyer, timedetail.RowDate;
SQL Statement works fine with PHPMyadmin or mysqli->query
create table mytable SELECT timeheader.Project, CONCAT('$',timeheader.Expenses) As Expenses, DATE_FORMAT(timedetail.RowDate,'%d/%m/%Y') AS Datum,SEC_TO_TIME(SUM( TIME_TO_SEC( timedetail.Duration ))) AS Hours, CONCAT('$',FORMAT(timeheader.Intern_Rate,2,'en_US')) as 'Intern per Hour', CONCAT('$',FORMAT(SUM( TIME_TO_SEC( timedetail.Duration ))/3600timeheader.Intern_Rate,2,'en_US')) AS 'Internal Cost', CONCAT('$',FORMAT(timeheader.Extern_Rate,2,'en_US')) as 'Extern per Hour', CONCAT('$',FORMAT(SUM( TIME_TO_SEC( timedetail.Duration ))/3600timeheader.Extern_Rate,2,'en_US')) AS 'Extern Cost', CONCAT('$',FORMAT(125,2,'en_US')) as 'Billable per Hour', CONCAT('$',FORMAT((SUM( TIME_TO_SEC( timedetail.Duration ))*(125/3600))+timeheader.Expenses,2,'en_US')) AS 'Billable' FROM timedetail LEFT JOIN timeheader ON timedetail.Identifyer = timeheader.Identifyer group by timeheader.Identifyer, timeheader.Project, timeheader.Intern_Rate, timeheader.Extern_Rate, timeheader.Expenses, timedetail.RowDate order by timeheader.Identifyer, timedetail.RowDate;