This topic is locked
[SOLVED]

 Error executing query

9/4/2013 6:45:29 PM
PHPRunner General questions
J
jebrown author

The following query works well when I run it directly in the MySQL database. However, it returns a "Error executing query" message when I run it in PHPRunner 6.2 (Build 16275). Any ideas?
SELECT

bikes.BikeID,

riders.Name,

bikes.Email,

bikes.Manufacturer,

bikes.Model,

bikes.Year,

bikes.PurchaseDate,

bikes.EndDate,

bikes.InitialMiles,

bikes.CurrentMiles,

(currentmiles - initialmiles) AS Miles_Ridden,

IF(ISNULL(bikes.EndDate), DATEDIFF(CURDATE(), bikes.PurchaseDate), DATEDIFF(bikes.EndDate, bikes.PurchaseDate)) AS "Total_Days",

(currentmiles - initialmiles)/IF(ISNULL(bikes.EndDate), DATEDIFF(CURDATE(),PurchaseDate), DATEDIFF(EndDate,PurchaseDate)) AS "Average_Miles_Per_Day",

bikes.CurrentDate AS Last_Update

FROM riders

LEFT OUTER JOIN bikes ON riders.EmailAddress = bikes.Email
Update: if I delete the two lines containing "ISNULL", the query works.

C
cgphp 9/5/2013

Remove " and " before and after Total_Days and Average_Miles_Per_Day.

J
jebrown author 9/5/2013



Remove " and " before and after Total_Days and Average_Miles_Per_Day.


That solved the problem. Thanks!