combining rows from 2 tables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jt

    combining rows from 2 tables

    Is there a way to create a view that combines all rows from 2 tables
    that have the same columns/fields?

    thanks,
    Judi
  • osy45

    #2
    Re: combining rows from 2 tables


    create view <view(col1, ... col<n>) as

    select col1, ... col<nfrom tab1

    union

    select col1, ... col<nfrom tab2

    /


    --
    Posted via http://dbforums.com

    Comment

    • Jan

      #3
      Re: combining rows from 2 tables

      SELECT col1, col2 ...
      FROM table_A
      UNION
      SELECT col1, col2 ...
      FROM table_B

      Comment

      • sybrandb@yahoo.com

        #4
        Re: combining rows from 2 tables

        judiphuongtu@ya hoo.com (jt) wrote in message news:<6f38222f. 0309172047.1115 58b6@posting.go ogle.com>...
        Is there a way to create a view that combines all rows from 2 tables
        that have the same columns/fields?
        >
        thanks,
        Judi
        create view blah as
        select *
        from table1
        union
        select *
        from table2

        Performance will be disastrous.
        Please reconsider the design

        Sybrand Bakker
        Senior Oracle DBA

        Comment

        • Guido Konsolke

          #5
          Re: combining rows from 2 tables

          "jt" <judiphuongtu@y ahoo.comschrieb im Newsbeitrag
          news:6f38222f.0 309172047.11155 8b6@posting.goo gle.com...
          Is there a way to create a view that combines all rows from 2 tables
          that have the same columns/fields?
          >
          thanks,
          Judi
          Hi Judi,

          minor addition to what 'osy45' and Sybrand wrote:
          performance will be better if you make it a
          UNION *ALL*.

          Greetings,
          Guido


          Comment

          Working...