teradata - SQL assign value for join purpose to null field without update -


with sample data...

c1  c2  c3 10    10a 11    **null** 12    **null** 13  b   13b 13  b   **null** etc.. 

i want assign c3 value rows null , c2 value same, not wish update value in table, use join table while select runs.

i able using inner select , join, want save processing power possible because amount of data huge , thought use of isnull or coalesce should able it, don't have enough experience figure on own yet, or if possible. think?

 select     a.c1,     a.c2,     coalesce( a.c3, b.c3) c3    table1       left join table1 b        on a.c2 = b.c2               a.c3 null              , b.c3 not null 

this work data have if there more 1 row not null c3 given c2 cause problems

if db supports max() over can this

select c1,        c2,        coalesce(c3, max(c3) on (partition c2)) c3 table1 

demo


Comments