I'm doing store procedure. But I have a doubt about the query that its results are two values. (@VarId)
I need to pass the two values in the second query, so that I can return the data that is not found in the tb_change
CREATE PROCEDURE sp_CambioSinAsignar
@IdProducto int
AS
BEGIN
declare @varId int
set @varId= (SELECT IdCambio from tb_Producto_Cambio where IdProducto=@IdProducto)
select distinct tb_Cambio.IdCambio, tb_Cambio.Nombre,tb_Cambio.Descripcion,
tb_Cambio.AproxHoras
from tb_Cambio
right join
tb_Producto_Cambio on tb_Cambio.IdCambio=tb_Producto_Cambio.IdCambio
where tb_Producto_Cambio.IdProducto<> @IdProducto and tb_Producto_Cambio.IdCambio<>
@varId
END