One specific Query doesn't run
Posted by: Francisco Pastrana
Date: April 01, 2013 10:32AM

Hi!

I have an issue running a group of querys on my app, but it really makes me headache that one specific query doesn't run. Here a brief explanation.

I'm converting Excel sheets into mysql tables, here everithing is allright.
then I declare a variable called "fecha", I use this variable several times in different querys and everything goes cool. but one specific query I'm sure is not working, worst there is no error message.

Here part of the code.

st.executeUpdate("UPDATE terminales_temporal a inner join (SELECT e.estatus, e.terminal,DATEDIFF('"+fecha+"',t.fecha_alta) FA FROM terminales_temporal t INNER JOIN estatus_terminales e ON t.terminal=e.terminal WHERE t.con_mov IS NULL AND e.mes=IF(t.mes=1,t.mes+11,t.mes-1)) b ON a.terminal = b.terminal SET a.estatus=1, a.descripcion_estatus = 'Sin Start' WHERE b.estatus = 1 AND FA >=0;");
st.executeUpdate("UPDATE terminales_temporal a inner join (SELECT e.estatus, e.terminal,DATEDIFF('"+fecha+"',t.fecha_alta) FROM terminales_temporal t INNER JOIN estatus_terminales e ON t.terminal=e.terminal WHERE t.con_mov IS NULL AND e.mes=IF(t.mes=1,t.mes+11,t.mes-1)) b ON a.terminal = b.terminal SET a.estatus=5, a.descripcion_estatus='Inicio de Inactividad' WHERE b.estatus in (2,3,4);");
st.executeUpdate("UPDATE terminales_temporal a inner join (SELECT e.estatus, e.terminal,DATEDIFF('"+fecha+"',t.fecha_alta) FROM terminales_temporal t INNER JOIN estatus_terminales e ON t.terminal=e.terminal WHERE t.con_mov IS NULL AND e.mes=IF(t.mes=1,t.mes+11,t.mes-1)) b ON a.terminal = b.terminal SET a.estatus=6, a.descripcion_estatus='Continua sin Operacion' where b.estatus in (5,6);");
==> this one is nor working st.executeUpdate("UPDATE terminales_temporal c inner join (SELECT d.terminal,DATEDIFF('"+fecha+"',d.fecha_alta) as FA FROM terminales_temporal as d WHERE d.con_mov IS NULL AND d.estatus IS NULL AND d.fecha_primer_mov IS NULL) as e on c.terminal = c.terminal SET c.estatus=1, c.descripcion_estatus = 'Sin Start' WHERE e.FA >=0;"); <====
st.executeUpdate("UPDATE terminales_temporal a inner join (SELECT terminal FROM terminales_temporal WHERE con_mov IS NULL AND fecha_cancel<>'0000-00-00') b on a.terminal = b.terminal SET estatus=7, descripcion_estatus='Cancelada';");

Any advice will be very apreciated, I don't know what else to show you.

Options: ReplyQuote


Subject
Written By
Posted
One specific Query doesn't run
April 01, 2013 10:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.