This is a migrated thread and some comments may be shown as answers.

DataSource Select Statement with a subquery don't works

1 Answer 182 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Cynthia
Top achievements
Rank 1
Cynthia asked on 04 Dec 2019, 10:17 PM

Hi, I have a query with a subquery works fine on sql, but when I use it as select statement on Configure Data Source Command  in my telerik report, this not work correctly, the results make me think the subquery don't works

This is my query in SQL

select * from apc_AlmacenProductoTerminado a
where a.SalidaAlmacen = 0 
and not exists
(select * from apc_AuditoriaALPC b
where b.FechaHora = @FechaAuditoria
and b.Boleta = a.Boleta)

The Telerik Query Builder give me this:

SELECT       a.Boleta, a.IdUsuario, a.FechaHora, a.Celda, a.Disponible, a.Vendido, a.SalidaAlmacen, b.NoEmpresa, b.Base, b.Boleta AS Expr1, b.Caja, b.NoCliente, b.Nombre, b.Camion, b.Fecha, b.HoraEntrada, b.HoraSalida, b.Familia, b.Material, 
                         b.Descripcion, b.Celda AS Expr2, b.Credito, b.Contado, b.PesoEntrada, b.Tara, b.Neto, b.Toneladas, b.Tarifa, b.Importe, b.Iva, b.Total, b.CostoTotal, b.Status, b.FechaFacturacion, b.FolioFactura, b.IdUsuario AS Expr3, b.NoGenerador, 
                         b.PesoCapturado, b.TaraCapturada, b.FolioPermiso, b.modificacion, b.firmado, b.firma, b.BasIN, b.BasOUT, b.UserIN, b.FolioFacturaContado
FROM            apc_AlmacenProductoTerminado AS a INNER JOIN
                         Boletas AS b ON a.Boleta = b.Boleta
WHERE        (a.SalidaAlmacen = 0) AND (NOT EXISTS
                             (SELECT       Boleta, IDUsuario, FechaHora
                               FROM             apc_AuditoriaALPC AS c
                               WHERE         (FechaHora = @FechaAuditoria) AND (Boleta = a.Boleta)))

 

But, when I run the report, the results not are correct, are there a restriction about this?

1 Answer, 1 is accepted

Sort by
0
Cynthia
Top achievements
Rank 1
answered on 05 Dec 2019, 03:52 PM
I'm so sorry, I finded the mistake, is about the region settings on the Date. Thanks
Tags
General Discussions
Asked by
Cynthia
Top achievements
Rank 1
Answers by
Cynthia
Top achievements
Rank 1
Share this question
or