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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.