Código SQL:
Ver original
SELECT dbo.Optimas.Linea,dbo.pesos.codoptima, dbo.pesos.Peso,dbo.htargets.Target, dbo.HTargets.Marca, dbo.pesos.Vaso, dbo.Optimas.Tubo, dbo.pesos.fecha FROM pesos INNER JOIN Optimas ON optimas.codigo = pesos.codoptima INNER JOIN htargets ON htargets.codOptima = pesos.codOptima AND datediff(DAY, htargets.fecha , pesos.fecha ) = 0 AND DATEPART(Hh, pesos.fecha) = DATEPART(Hh, htargets.fecha) WHERE optimas.codigo IN(82,83,84,85,86,87,88,89,90,92,91,93,95,94,96,98,97,99)AND dbo.htargets.Fecha >='9/10/2012 3:48:00 PM' AND dbo.htargets.fecha <='9/28/2012 4:09:02 PM' AND target=1000.00 ORDER BY peso ASC
Uploaded with ImageShack.us