0
votes

I am trying to run belwo query

UPDATE tempd tvl
                SET id = case 
                            when tse.id is null or tse.id = 0 then --coalesce(nullif(tse.id,0),5) 
                             5  
                            else  
                                tse.event_id  end  
            FROM details tse 
            WHERE
                tvl.id = tse.id
            AND tvl.name = tse.name
            AND tvl.add =  tse.add;

But I am getting always 0 in id column

also Can we update from multiple table like if matche from one table then take from first table if matched from second table then take from sencond table else default value

Thanks