Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Tengo esta consulta, primero se genero en SQL Server y ahora debo implementarla en QlikView. Pero me marca un mensaje de error.
La conexión a la base de datos esta realizada correctamente. Creo que es un error de sintaxis agradecería quien pueda ayudarme
NotasContables:
load *;
SQL
SELECT
t253.f253_id AS "f_auxiliar",
t253.f253_descripcion AS "f_desc_auxiliar",
t285_co_docto.f285_id AS "f_co_docto",
t285_co_mov.f285_id AS "f_co_movto",
t281.f281_id AS "f_un_movto",
sum(t351.f351_valor_db) AS "f_valor_debito",
sum(t351.f351_valor_cr) AS "f_valor_credito",
sum(t351.f351_valor_db) - sum(t351.f351_valor_cr) AS "f_valor_neto",
t350.f350_id_mandato AS "f_cod_contrato_man",
t070.f070_descripcion AS "f_desc_contrato_man",
CASE WHEN NOT t070.f070_ind_tipo
IS NULL THEN CASE t070.f070_ind_tipo
WHEN 1 THEN t200_ter_cli_man.f200_id
ELSE t200_ter_prov_man.f200_id
END ELSE ' '
END AS "f_tercero_mandante",
CASE WHEN NOT t070.f070_ind_tipo
IS NULL THEN CASE t070.f070_ind_tipo
WHEN 1 THEN t201_cli_man.f201_id_sucursal
ELSE t202_prov_man.f202_id_sucursal
END ELSE ' '
END AS "f_sucursal_mandante",
CASE WHEN NOT t070.f070_ind_tipo
IS NULL THEN CASE t070.f070_ind_tipo
WHEN 1 THEN t201_cli_man.f201_descripcion_sucursal
ELSE ' '
END AS "f_desc_mandante", t351.f351_fecha AS "f_fecha", t351.f351_rowid_movto_entidad AS "f_rowid_movto_entidad"
FROM
"unoee_studiof".dbo."t351_co_mov_docto" AS t351
INNER JOIN "unoee_studiof".dbo."t350_co_docto_contable" AS t350 ON t350.f350_rowid = t351.f351_rowid_docto
INNER JOIN "unoee_studiof".dbo."t254_co_mayores_auxiliares" AS t254
ON t254.f254_rowid_auxiliar = t351.f351_rowid_auxiliar
AND t351.f351_id_cia = t254.f254_id_cia
INNER JOIN "unoee_studiof".dbo."t253_co_auxiliares" AS t253
ON t253.f253_rowid = t351.f351_rowid_auxiliar
INNER JOIN "unoee_studiof".dbo."t285_co_centro_op" AS t285_co_mov
ON t285_co_mov.f285_id_cia = t351.f351_id_cia
AND t285_co_mov.f285_id = t351.f351_id_co_mov
INNER JOIN "unoee_studiof".dbo."t281_co_unidades_negocio" AS t281
ON t281.f281_id_cia = t351.f351_id_cia
AND t281.f281_id = t351.f351_id_un
INNER JOIN "unoee_studiof".dbo."t285_co_centro_op" AS t285_co_docto
ON t285_co_docto.f285_id_cia = t350.f350_id_cia
AND t285_co_docto.f285_id = t350.f350_id_co
LEFT OUTER JOIN "unoee_studiof".dbo."t070_mm_mandatos" AS t070 ON t070.f070_id_cia = t350.f350_id_cia
AND t070.f070_id = t350.f350_id_mandato
LEFT OUTER JOIN "unoee_studiof".dbo."t200_mm_terceros" AS t200_ter_cli_man
ON t200_ter_cli_man.f200_rowid = t070.f070_rowid_tercero_cli
LEFT OUTER JOIN "unoee_studiof".dbo."t200_mm_terceros" AS t200_ter_prov_man
ON t200_ter_prov_man.f200_rowid = t070.f070_rowid_tercero_prov
LEFT OUTER JOIN "unoee_studiof".dbo."t201_mm_clientes" AS t201_cli_man
ON t201_cli_man.f201_rowid_tercero = t070.f070_rowid_tercero_cli
AND t201_cli_man.f201_id_sucursal = t070.f070_id_sucursal_cli
LEFT OUTER JOIN "unoee_studiof".dbo."t202_mm_proveedores" AS t202_prov_man
ON t202_prov_man.f202_rowid_tercero = t070.f070_rowid_tercero_prov
AND t202_prov_man.f202_id_sucursal = t070.f070_id_sucursal_prov
WHERE (t350.f350_id_cia = 1)
AND (t350.f350_id_periodo BETWEEN '200609' AND '201311')
AND (t350.f350_fecha BETWEEN '01/10/2011' AND '01/11/2013')
AND (t350.f350_ind_estado = '1')
AND (t254.f254_id_plan = 'PUC')
GROUP BY t253.f253_id2, t253.f253_descripcion, t285_co_mov.f285_id, t281.f281_id, t350.f350_id_mandato, t070.f070_descripcion,
CASE WHEN NOT t070.f070_ind_tipo
IS NULL THEN CASE t070.f070_ind_tipo
WHEN 1 THEN t200_ter_cli_man.f200_id
ELSE t200_ter_prov_man.f200_id
END ELSE ' '
END,
CASE WHEN NOT t070.f070_ind_tipo
IS NULL THEN CASE t070.f070_ind_tipo
WHEN 1 THEN t201_cli_man.f201_id_sucursal
ELSE t202_prov_man.f202_id_sucursal
END ELSE ' '
END,
CASE WHEN NOT t070.f070_ind_tipo
IS NULL THEN CASE t070.f070_ind_tipo
WHEN 1 THEN t201_cli_man.f201_descripcion_sucursal
ELSE t202_prov_man.f202_descripcion_sucursal
END ELSE ' '
END, t285_co_docto.f285_id, t351.f351_fecha, t351.f351_rowid_movto_entidad
;
Mensaje de error es: ErrorSource: (null), ErrorMsg: (null)
Primero prueba quitando las comillas dobles. Si no te funciona, prueba haciendo un view con ese sql y lo tercero o mas dificil para este caso seria tomar esas tablas y leerlas y hacer todo en el script de QV.