I have the following query
Select L.idtipolocalidad from Localidad L
inner join RecepcionDetalleAbierta RDA on RDA.idLocalidadAlmacenado = L.IdLocalidad
inner join Localidad L1 on RDA.IdLocalidad = L1.IdLocalidad where l1.Codigo = 'PREC36'
group by L.IdTipoLocalidad'
It results in a 5 but what I try to do is that if it brings 5 save to a variable 1 otherwise 0
I hope you can help me.
This is my attempt but I do not have it left
SET @vEnvioCompleto = (SELECT CASE WHEN L.IdTipoLocalidad = 5 THEN 1 ELSE 0 END FROM RecepcionDetalleAbierta RDA
INNER JOIN Localidad L ON L.IdLocalidad = RDA.IdLocalidadAlmacenado
inner join Localidad L1 on RDA.IdLocalidad = L1.IdLocalidad
WHERE L.Codigo = 'PREC36')
Thanks