473,385 Members | 1,396 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,385 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 3491

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.