Du har ett syntaxfel i SQL:en. Skriv ut den färdiga frågan (eller läs felmeddelandet!) så ser du vad det är.
hej jag har följande sql sats som jag vill bädda in i javascript. det fungarar bra att hämta värde när jag inte behöver hämta data från 2 tabeller men det blir fel när det är fler tabeller. nån som vet hur jag borde skriva?
Min fungerande sats iMysql browser ser ut så här:
select name_,d.id_,
sec_to_time(min(time_to_sec(TIMEDIFF(end_,start_)))) as minduration,
sec_to_time(max(time_to_sec(TIMEDIFF(end_,start_)))) as maxduration,
sec_to_time(avg(time_to_sec(TIMEDIFF(end_,start_))))as avgduration
from jbpm_processdefinition d, jbpm_processinstance i
where d.id_=i.processdefinition_ and name_ =?;
i javascript skriver jag så här:
...
this.queryText = "Select name_,ID_, (sec_to_time(min(time_to_sec(TIMEDIFF(end_,start_))))) as minduration,(sec_to_time(max(time_to_sec(TIMEDIFF(end_,start_))))) as maxduration,(sec_to_time(avg(time_to_sec(TIMEDIFF(end_,start_)))))as avgduration"
this.queryText += "from jbpm_processinstance, jbpm_processdefinition"
this.queryText += "where jbpm_processdefinition.id_ = jbpm_processinstance.processdefinition_ and name_ IN ("
if (NameParamLength > 0 ) {...
Felet ligger just där vid where delen...
Felet jag får är:
An exception occurred during processing. Please see the following message for details:
Cannot get the result set metadata.
SQL statement does not return a ResultSet object.
SQL error #1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'jbpm_processinstance, jbpm_processdefinitionwhere jbpm_processdefinition.id_ = j' at line 1

