Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
qvale
Contributor III
Contributor III

Intervalo de Fecha

Hola a todos. Necesito su ayuda. Tengo problemas para definir un intervalo de fecha en el script. La base de la que estoy levandando la información es de Visual Fox. La idea es que de la tabla h_detmov solo cargue los datos que sean de una fecha inferior a 01/06/2010. El Campo fecha forma parte de la tabla.

LOAD codunico,
fecha,
pu,
codmon,
dto,
codgrupo;

SQL SELECT *
FROM `h_detmov` where fecha < '01/06/2010';

pero intente me salta el error:

Error de SQL:Operator/operand type mismatch.
Línea de Script:SELECT * FROM `h_detmov` where fecha < 01/06/2010
SQL SELECT *
FROM `h_detmov` where fecha < 01/06/2010

espero que alguien tenga alguna sugerencia.

Desde ya muchas gracias.

Ale

3 Replies
johnw
Champion III
Champion III

How your date field is stored is how you must reference it in SQL. For instance, a lot of our dates are stored as an integer like this:

20100601

Therefore, my SQL is this:

WHERE date < 20100601

But there are a lot of other date formats that you could be using. Whatever date format the database is using is the date format you need to use when comparing a literal to the database field. That is what the SQL error is telling you.

qvale
Contributor III
Contributor III
Author

Hola John.

No esta tomando el formato que sugeriste, pero si decis que el error el por el formato, voy a investigar un poco mas e ir probando otros, hasta que uno funcione.

Gracias.

Not applicable

también puedes tratar convirtiendo la fecha a numero, por ejemplo 01/06/2010 es el numero 40330.