Welcome to Sign in | Help

clauza where cu case sau if

  •  08-16-2007, 12:59 PM

    clauza where cu case sau if

    am un select cu clauza where

    pot pune la clauza where case sau if

    adica vreau sa pun ceva de genul

    SELECT p.id, p.id AS masina_id, p.tip_masina, p.marca_model, f.id AS Expr1, f.id_masina, f.polita, f.data_asig,f.soc, f.data_exp, f.suma_asig, f.prima, f.val_casco, f.procent, f.desp_casco, f.RSA FROM tblMasina AS p left JOIN tblASIBAN AS f ON p.id = f.id_masina where case when (f.soc=0 ) then  f.soc=0  else f.soc=3 end

    primesc eroarea

    Msg 102, Level 15, State 1, Line 1
    Incorrect syntax near '='.

     Adica as vrea ca in clauza where sa aiba o conditie daca f.soc=0 si alta daca f.soc!=0

    Se poate,ceva sugestii? 

     

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems