Hola
estoy haciendo una función qeu me devuelve el precio de un articulo a través
de la variable @pv, para ello necisto hacer el cálculo como:
if not exists (select @pv = preu_especial from t_PreusEspecials where
fk_article=@article and fk_tercer=@tercer)
select @pv = preu_venta from t_articles where id_article = @article
Pero no puedo en el mismo select q miro si existe asignar el valor a mi
variable, y tengo q hacer ...
if exists (select preu_especial from t_PreusEspecials where
fk_article=@article and fk_tercer=@tercer)
select @pv = preu_especial from t_PreusEspecials where
fk_article=@article and fk_tercer=@terce
else
select @pv = preu_venta from t_articles where id_article = @article
hay forma de mejorar esto???
gracias de nuevo
Leer las respuestas