I'm trying to load a plan to update the promotion group. I have the following option of select, when option 4 is selected, which is a reference provider, it is necessary to create a temporary table so that the update is made to the desired table since it is
//opcion select
select id="subir_con" name="planoc1">
option value="1">Codigo de Barra</option>
option value="2">Codigo de Plu</option>
option value="3">Codigo de referencia</option>
option value="4">Codigo de referencia proveedor</option>
/select>
And this is the indication that is given to the program.
the temporary is created
file data is inserted
I do a select with a jion to bring the data that is needed to be able to do the update (this is done because in the table that is going to do the update, you do not have the field d_referencia_provider) and it is generated the temporary group_promotion_tmp2
with this last generated table the update is performed.
if ($planoc1 == 4) { $sql = "create temp table grupo_promocion_tmp". "(d_referencia_prov char(40) not null,". "grupo_promocion char(5));"; $vectorDeConsultas[$idxDeConsultas] = $sql; $idxDeConsultas = $idxDeConsultas + 1; $sql = " INSERT INTO grupo_promocion_tmp". " (d_referencia_prov,grupo_promocion)". " VALUES ('$campo1','$grupo_promocion');"; $vectorDeConsultas[$idxDeConsultas] = $sql; $idxDeConsultas = $idxDeConsultas + 1; $sql = " SELECT b.c_producto,b.d_referencia_prov,a.grupo_promocion". " FROM grupo_promocion_tmp a, m_productos b". " WHERE a.d_referencia_prov=b.d_referencia_prov ". " INTO TEMP grupo_promocion_tmp2 WITH NO LOG"; $vectorDeConsultas[$idxDeConsultas] = $sql; $idxDeConsultas = $idxDeConsultas + 1; $sql = " DROP TABLE grupo_promocion_tmp"; $vectorDeConsultas[$idxDeConsultas] = $sql; $idxDeConsultas = $idxDeConsultas + 1; $sql = "UPDATE dt_productos SET". "grupo_promocion =(select grupo_promocion FROM grupo_promocion_tmp2 WHERE dt_productos.c_producto = grupo_promocion_tmp2.c_producto) WHERE c_producto in (select c_producto from grupo_promocion_tmp2) "; $vectorDeConsultas[$idxDeConsultas] = $sql; $idxDeConsultas = $idxDeConsultas + 1; }
when executing the option, it only executes the last statement and generates error -206 indicating that there is no tmp2_promotion_group.
eh omitted any step?