sql - Selectively populating result column -
i have query fetches result multiple tables:
select ta.c1 columna, tb.c1 columnb, tc.c1 columnc tablea ta, tableb tb, tablec tc --business conditions the result fetched below:

is want result fetched in a separate columnd, has value each corresponding value of columna e.g:

ps: if not null , value of columnb takes priority on value of columnc (for example row 4)
can suggest way achieve ?
you can use coalesce operator.
select ta.c1 columna, coalesce(tb.c1, tc.c1) columnb tablea ta, tableb tb, tablec tc
Comments
Post a Comment