Subject | Filter problem |
---|---|
Author | yartax1 |
Post date | 2004-12-07T09:22:18Z |
Hi,
I've a TIBQuery with a query that runs ok. The monitor show next:
*****************************************
[ 07/12/2004 10:14:31 ]
PREPARE STATEMENT
TR_HANDLE = 22708716
STMT_HANDLE = 57401556
Select a.*,b.destcon,d.nombre , d.apellido1, d.apellido2 from
no_nomina a inner join no_contrato b on a.empleado = b.empleado and
a.orden = b.orden and a.empresa = b.empresa inner join usuario_centro
c on lefts(destcon,2) = rights(c.centro,2) inner join no_empleados d
on a.empleado= d.empleado where c.idusuario = 1 and a.ano = 2004 and
a.mes = 12
ORDER BY ano ASC
, mes ASC
PLAN SORT (JOIN (A NATURAL,D INDEX (PK_NO_EMPLEADOS),B INDEX
(PK_NO_CONTRATO),C INDEX (FK_USUARIO)))
****************************************
That's all right. After that, I try to do next sentences:
dbnominas->Filtered = false;
dbnominas->Filter = "lefts(destcon,2) = rights('" + ( AnsiString )
dbcentro->FieldValues["centro"] + "',2) ";
dbnominas->Filtered = true;
Where dbcentro->FieldsValues["centro2] equals to '0371' for example.
When apply filter get error -104; token unknown. In the monitor appear
s next query:
Select a.*,b.destcon,d.nombre , d.apellido1, d.apellido2 from
no_nomina a inner join no_contrato b on a.empleado = b.empleado and
a.orden = b.orden and a.empresa = b.empresa inner join usuario_centro
c on lefts(destcon,2) = rights(c.centro,2) inner join no_empleados d
on a.empleado= d.empleado
where c.idusuario = 1 and a.ano = 2004 and a.mes = 12
AND (lefts(destcon,2) = rights AND ('0371' , 2))
ORDER BY ano ASC
, mes ASC
The where clausule isn't correct, and I don't know why!! Any idea?
I've a TIBQuery with a query that runs ok. The monitor show next:
*****************************************
[ 07/12/2004 10:14:31 ]
PREPARE STATEMENT
TR_HANDLE = 22708716
STMT_HANDLE = 57401556
Select a.*,b.destcon,d.nombre , d.apellido1, d.apellido2 from
no_nomina a inner join no_contrato b on a.empleado = b.empleado and
a.orden = b.orden and a.empresa = b.empresa inner join usuario_centro
c on lefts(destcon,2) = rights(c.centro,2) inner join no_empleados d
on a.empleado= d.empleado where c.idusuario = 1 and a.ano = 2004 and
a.mes = 12
ORDER BY ano ASC
, mes ASC
PLAN SORT (JOIN (A NATURAL,D INDEX (PK_NO_EMPLEADOS),B INDEX
(PK_NO_CONTRATO),C INDEX (FK_USUARIO)))
****************************************
That's all right. After that, I try to do next sentences:
dbnominas->Filtered = false;
dbnominas->Filter = "lefts(destcon,2) = rights('" + ( AnsiString )
dbcentro->FieldValues["centro"] + "',2) ";
dbnominas->Filtered = true;
Where dbcentro->FieldsValues["centro2] equals to '0371' for example.
When apply filter get error -104; token unknown. In the monitor appear
s next query:
Select a.*,b.destcon,d.nombre , d.apellido1, d.apellido2 from
no_nomina a inner join no_contrato b on a.empleado = b.empleado and
a.orden = b.orden and a.empresa = b.empresa inner join usuario_centro
c on lefts(destcon,2) = rights(c.centro,2) inner join no_empleados d
on a.empleado= d.empleado
where c.idusuario = 1 and a.ano = 2004 and a.mes = 12
AND (lefts(destcon,2) = rights AND ('0371' , 2))
ORDER BY ano ASC
, mes ASC
The where clausule isn't correct, and I don't know why!! Any idea?