Alguien conoce una forma eficaz para hacer esto¡?
Código SQL:
Ver original
@fecha datetime, @linea nvarchar(5), @hora nvarchar(15) AS BEGIN SET Nocount ON SELECT h.hora AS hora1,h.marca,h.target,h.fecha AS hfecha,p.hora,p.peso,p.fecha,o.linea FROM optimas AS o INNER JOIN pesos AS p ON o.codigo = p.codoptima INNER JOIN htargets AS h ON o.codigo = h.codoptima WHERE o.linea = @linea AND p.fecha >= @fecha AND h.fecha >= @fecha AND p.hora = @hora AND h.hora = @hora ORDER BY fecha SELECT @@rowcount AS 'RowsReturned'