Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL Statement doesn't work

Hi to All!!!

i have one sql statement but it doesnt work on Qlikview, but it does in SQL:

Transac:

LOAD

IdentifEspacio,

HoraInicio_EC,

HoraFin_EC,

PautaId,

AnoMes,

HoraInicio_OC,

HoraFin_OC,

CantSalidas,

DuracionTot,

VigDesde_CV,

VigHasta_CV,

Frecuencia_CV,

Horario,

Version

;

SQL SELECT EspacioCont.IdentifEspacio, EspacioCont.HoraInicio as HoraInicio_EC, EspacioCont.HoraFin as HoraFin_EC,

OrdenadoCab.PautaId, OrdenadoCab.AnoMes, OrdenadoCab.HoraInicio as HoraInicio_OC, OrdenadoCab.HoraFin as HoraFin_OC, OrdenadoCab.CantSalidas, OrdenadoCab.DuracionTot,

CostoVersion.VigDesde as VigDesde_CV, CostoVersion.VigHasta as VigHasta_CV, CostoVersion.Frecuencia as Frecuencia_CV, CostoVersion.Horario, CostoVersion.Version

FROM

  Publicidad.dbo.EspacioCont ,

  Publicidad.dbo.OrdenadoCab ,

  Publicidad.dbo.CostoVersion

where

  EspacioCont.IdentifEspacio = 'AMER-INTR-PROG' and

  OrdenadoCab.IdentifEspacio = EspacioCont.IdentifEspacio and

  CostoVersion.IdentifEspacio = OrdenadoCab.IdentifEspacio and

  CostoVersion.Version = (select max(CostoVersion.version)

                    from Publicidad.dbo.CostoVersion

                    where CostoVersion.IdentifEspacio = EspacioCont.IdentifEspacio

                    group by CostoVersion.IdentifEspacio)

order by

  EspacioCont.IdentifEspacio;

Why doesnt return me any row???  In Sql the query HAVE 28 rows...

Any Idea?

Thanks to all!

20 Replies
Not applicable
Author

Hi Torress,

Instead of renaming in SQL script try to rename in LOAD statement.Remove alias in SQL use drirect fields to load and then rename the fields as per your requirement.

It may solve your problem.

Regards,

Vijay

Anonymous
Not applicable
Author

German,

What if your script contains this code but nothing else?  Can you try it?  I expect it to return the same 28 rows.

Check if there is something like INNER JOIN or INNER KEEP, or anything in your script that may affect records in the Transac table.

Regards,

Michael

Not applicable
Author

I made this change:

Transac:

LOAD

IdentifEspacio,

HoraInicio as HoraInicio_EC,

HoraFin as HoraFin_EC,

PautaId,

AnoMes,

HoraInicio as HoraInicio_OC,

HoraFin as HoraFin_OC,

CantSalidas,

DuracionTot,

VigDesde as VigDesde_CV,

VigHasta as VigHasta_CV,

Frecuencia as Frecuencia_CV,

Horario,

Version

;

SQL SELECT EspacioCont.IdentifEspacio, EspacioCont.HoraInicio, EspacioCont.HoraFin,

OrdenadoCab.PautaId, OrdenadoCab.AnoMes, OrdenadoCab.HoraInicio, OrdenadoCab.HoraFin, OrdenadoCab.CantSalidas, OrdenadoCab.DuracionTot,

CostoVersion.VigDesde, CostoVersion.VigHasta, CostoVersion.Frecuencia, CostoVersion.Horario, CostoVersion.Version

FROM

  Publicidad.dbo.EspacioCont ,

  Publicidad.dbo.OrdenadoCab ,

  Publicidad.dbo.CostoVersion

where

  EspacioCont.IdentifEspacio = 'AMER-INTR-PROG' and

  OrdenadoCab.IdentifEspacio = EspacioCont.IdentifEspacio and

  CostoVersion.IdentifEspacio = OrdenadoCab.IdentifEspacio and

  CostoVersion.Version = (select max(CostoVersion.version)

                    from Publicidad.dbo.CostoVersion

                    where CostoVersion.IdentifEspacio = EspacioCont.IdentifEspacio

                    group by CostoVersion.IdentifEspacio)

order by

  EspacioCont.IdentifEspacio;

And it doesnt solve the problem...

Thanks anyway Vijay

Not applicable
Author

Michael

Im trying with this instruction only... nothing else.

And if i bring only one table, it does return me results.

But when i add other table in the same query...  no results...

Anonymous
Not applicable
Author

Not clear, sorry...

Is there any difference if you use only this (and nothing else in whole script):

LOAD

...

SQL SELECT

...

;

And if you use only this (and nothing else in whole script):

SQL SELECT

...

;

Not applicable
Author

i tryied and rerutns mi ODBC Error... 

Anonymous
Not applicable
Author

What exactly the error is?

Is it for SQL SELECT without LOAD?

Not applicable
Author

The message say: Fail reading ODBC

Anonymous
Not applicable
Author

Hmm...  Can't help with this...  I assume you haven't changed the  CONNECT statement.

ODBCs sometimes not reliable.  I recommend OLEDB instead, if possible.