This topic is locked
[SOLVED]

 Good Query - But PHPR Error

3/16/2016 12:48:42 AM
PHPRunner General questions
bbarker author

I get this error message:

Parse error: syntax error, unexpected '=' in C:\inetpub\wwwroot\abc\include\statistics-veh_settings.php on line 7
For this code:

SELECT CASE

WHEN idyear_veh < 10 THEN '1910s'

WHEN idyear_veh >= 10 AND idyear_veh < 20 THEN '1920s'

WHEN idyear_veh >= 20 AND idyear_veh < 30 THEN '1930s'

WHEN idyear_veh >= 30 AND idyear_veh < 40 THEN '1940s'

WHEN idyear_veh >= 40 AND idyear_veh < 50 THEN '1950s'

WHEN idyear_veh >= 50 AND idyear_veh < 60 THEN '1960s'

WHEN idyear_veh >= 60 AND idyear_veh < 70 THEN '1970s'

WHEN idyear_veh >= 70 AND idyear_veh < 80 THEN '1980s'

WHEN idyear_veh >= 80 AND idyear_veh < 90 THEN '1990s'

END AS Years,

count(*) AS VehicleCount

FROM reg_veh t1

LEFT JOIN vehyear_vyr t2 ON t1.idyear_veh=t2.id_vyr

LEFT JOIN vehmake_vmk t3 ON t1.idmake_veh=t3.id_vmk

LEFT JOIN vehmodel_mdl t4 ON t1.idmodel_veh=t4.id_mdl

LEFT JOIN vehstyle_vsl t5 ON t1.idstyle_veh=t5.id_vsl

LEFT JOIN members_mbr t6 ON t1.idmember_veh=t6.id_mbr

LEFT JOIN reg_met t7 ON t7.idmember_met=t6.id_mbr

WHERE t1.idmodel_veh IS NOT NULL

AND t1.idstyle_veh IS NOT NULL

AND t7.active_met=1

GROUP BY Years

ORDER BY Years
NOTE: The Query works good in preview.

ANY SUGGESTIONS? Thanks in advance.

bbarker author 3/19/2016

This part was very frustrating: "unexpected '='"
I removed every single '=' and still got the error.

I even modified the '>= 10' to '>9' for all of the comparisons.

Still an error.
Finally, I created a brand new REPORT, re-entered all of the query and saved it.
It WORKS. So, my conclusion, after two days of wasted trouble-shooting, is to first just duplicate the table or report and .

Let PHPRunner do it's thing.

Sometimes you just can't out-think it. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=79047&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />