Hola, tengo el siguiente codigo...
declare @Nombre varchar(50), @FechaDesde datetime, @FechaHasta datetime
set @Nombre='per'
set @FechaDesde='03/08/1973'
set @FechaHasta='01/01/2009'
select cambioshistorico.codven, cambioshistorico.fecha,
cliente.codcli, cliente.apellnomb,
cambioshistorico.descripcion, cambioshistorico.importe
from cambioshistorico
inner join ventas on ventas.tipo='n'
inner join cliente on cliente.apellnomb like @nombre + '%' and
cliente.codcli=ventas.codcli
and ventas.tipo='n'
and cambioshistorico.Fecha between @fechaDesde
and @fechaHasta
Esto me deberia tirar la siguiente lista:
2014 2006-03-08 00:00:00.000 24 PERALTA CEFERINA F -15.7000
2009 2006-03-07 00:00:00.000 321 PEREZ
-18.1800
Pero en su lugar me tira esto otro...
2014 2006-03-08 00:00:00.000 24 PERALTA CEFERINA F -15.7000
2009 2006-03-07 00:00:00.000 24 PERALTA CEFERINA -18.1800
2014 2006-03-08 00:00:00.000 321 PEREZ IGNACIO F -15.7000
2009 2006-03-07 00:00:00.000 321 PEREZ
-18.1800
¿Por que es esto y como lo soluciono?
Daniel
Leer las respuestas