473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

combining rows from 2 tables

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

thanks,
Judi
Jul 19 '05 #1
4 3492

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

select col1, ... col<n> from tab1

union

select col1, ... col<n> from tab2

/
--
Posted via http://dbforums.com
Jul 19 '05 #2
Jan
SELECT col1, col2 ...
FROM table_A
UNION
SELECT col1, col2 ...
FROM table_B
Jul 19 '05 #3
ju**********@yahoo.com (jt) wrote in message news:<6f**************************@posting.google. 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
Jul 19 '05 #4
"jt" <ju**********@yahoo.com> schrieb im Newsbeitrag
news:6f**************************@posting.google.c om...
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
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: JackT | last post by:
Hi, I have the following SQL SELECT Table1.Col1, Table3.Col1 AS Expr1, COUNT(Table1.Col2) AS Col2_No, COUNT(Table1.Col3) AS Col3_No etc, FROM Table3 INNER JOIN Table2 ON...
8
by: Ilan | last post by:
Hi all I need to add data from two Excel sheets (both on the same workbook) to an existing table in my SQL DB. The problem is that each sheet holds different fields for the same record, though...
3
by: Tome73 | last post by:
How can I easily add the rows of DataTable1 to the rows of DataTable2. Both queries are from the same table. I can always use the column names with myRow, but I was wishing for a shortcut. When I...
5
by: Matthias Nagl | last post by:
Hello List! I would like to combine the contents of several rows of a subquery. After several hours of search in the documentation and the internet I didn'T find a solution and hope anyone can...
11
by: Bonzol | last post by:
Hey there, just starting out using data tables, can anyone tell me how to combine 2 tables? Ive tried just coyping the info from 1 table to another, which both have exactly the same table layout...
0
by: Hexman | last post by:
Hello All, I'm stumped with this one. I have a Database table ("PROD") and I have set up 2 different opens for it. As you can see I alias two of the columns in the first open. I run...
4
by: jt | last post by:
Is there a way to create a view that combines all rows from 2 tables that have the same columns/fields? thanks, Judi
1
by: slinky | last post by:
Thanks for any help folks: I have two .aspx pages that are workling well: one is for entering entries in a blog and another for viewing those entries. What I want to do is combine the two into...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.