postgresql - How to put where clause for multiple columns while updating multiple columns at the same time? -


I want to update more than 10 columns at the same time, and my problem is where I stand all these I want to do the columns.

My code is:

  Set as customer UPDATE C name = a.name, address = a.address, telephone = a.telephone, - - - customer From an INNER join (Season Casember, Max (Current Debt) from ASMD, from Customer Group, Casember) on Z Zaasianumber = a.casenumber and z.md = a.currentDATE where (a.casenumber = c.casenumber)   

In the above statement, I want to add the condition to update the column only if it is not 0.

For exmple

  update as the customer name set = a.name, address = a.address, ... .. where a.name & lt ; & Gt; 0, A.Edress & lt; & Gt; 0, A. Telephones & lt; & Gt; 0 .... ...   

Is it possible to place where to check each column?

Any suggestion is appreciated ..

something like that name is a typo and your names are actually character columns)

  update as the customer name set = name when the name & Lt; & Gt; '' then one. Name ELSE Name END, Address = Case When Address & lt; & Gt; '' Then A. Address ELSE address END   

This column updates to the current value if it is empty

Note that it is not dealing with zero values ! If you need to treat zero and '' , then you need to use collages (name, '') instead.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -