Jump to content

Mystery Syntax Error


ShadowMage

Recommended Posts

Hey guys, I need your help again. I've got a query I put together and it's throwing an error at me. Here's what I get:Warning: odbc_exec() [function.odbc-exec]: SQL error: [DataDirect-Technologies][ODBC PROGRESS driver][PROGRESS]Syntax error (7587), SQL state 37000 in SQLExecDirect in c:\Inetpub\phplib\ODBC.php on line 229Error! Couldn't Run Query:SELECT JobOper.JobNum, JobOper.OpCode, (JobOper.EstProdHours + JobOper.EstSetHours) AS 'EstHours', (JobOper.ActProdHours + JobOper.ActSetupHours) AS 'ActHours', CASE(JobOper.EstProdHours + JobOper.EstSetHours) WHEN 0 THEN 0 ELSE(((JobOper.ActProdHours + JobOper.ActSetupHours) / (JobOper.EstProdHours + JobOper.EstSetHours)) * 100) END AS 'Percentage' WHERE ((JobOper.JobNum LIKE 'e%') AND (JobOper.JobComplete <> 0) AND ((JobOper.OpCode = 'PSub') OR (JobOper.OpCode = 'PProd') OR (JobOper.OpCode = 'CkAll'))) ORDER BY JobOper.JobNum ASC, JopOper.OpCode ASCError Message: [DataDirect-Technologies][ODBC PROGRESS driver][PROGRESS]Syntax error (7587)Now I've looked at this thing, and I can't for the life of me see where there's a syntax error. It could be something with my CASE statements since I've never used them before. I've checked all the table names and field names, checked my parens, checked my logic operators, and it all seems to check out. Is there something wrong with the CASE or my arithmetic operators?

Link to comment
Share on other sites

ORDER BY JobOper.JobNum ASC, JopOper.OpCode ASCDoes it matter that there's no FROM? I'm not familiar with Progress.
Wow. :) Can't believe I missed the FROM.... :) You wouldn't believe how long I stared at that, and how many times I went through that query, and I still missed the fact that I didn't have a FROM.Thank you, JSG.BTW, thanks for pointing out my spelling mistake, too. Though I think the missing FROM is the error it was throwing at me. It never even got down to my typo.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...