Need to build common select field in SQL using set operators oracle - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need to build common select field in SQL using set operators oracle

Hi all,

Required to know how to build common select fields in sql's using Set operator (union or intersect or minus or union all)

ex:
select a, b, c from table1
union
select a,b,c,p,q from table2
union
select a,b,c,m,n from table3

Required to build select fields before execution as;

[color=Blue]select a, b, c, NULL as p, NULL as m, NULL as q , NUll as n from table1
union
select a, b, c, p,NULL as m, q, NULL as n from table2
union
select a, b, c, NULL as p,m,NULL as q, n from table3[/color]

and this can grow for any number of set operators and sql's.

Basically need to compare three array of structures and arrive at common fields.

Could you please let me know if any flash on this query.

regards
jarbangy



Sign In or Register to comment.