[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Newbie - combining two identical tables

Posted on 2005-05-17
3
Medium Priority
?
210 Views
Last Modified: 2010-03-19
I have manually separated a large database (well large to me) into two tables,  one DRAWCURR and DRAWOLD
for current drawings and old drawings

Most of the time the users just need to access the DRAWCURR, but sometimes I might want to provide a VIEW? or some recordset (called DRAWALL?) which combines the two identical tables but I am at a loss on how to do this.

I suspect this is easy SQL.

I am not sure if I want a join or what to do

I have looked in the syntax guides but I am just getting confused as the tables are not really related  

TIA-NaomiG
0
Comment
Question by:NaomiG
3 Comments
 
LVL 23

Assisted Solution

by:adathelad
adathelad earned 100 total points
ID: 14017666
Hi,

You can use a UNION ALL to do this:

e.g.
SELECT Field1, Field2 FROM DRAWCURR
UNION ALL
SELECT Field1, Field2 FROM DRAWOLD

This "unions" (combines) both results into one recordset

0
 

Author Comment

by:NaomiG
ID: 14017717
Can I save it somehow by name (DRAWALL) to use again ?
0
 
LVL 3

Accepted Solution

by:
r_a_j_e_s_h earned 100 total points
ID: 14017749

CREATE VIEW DrawAll
AS
SELECT Field1, Field2 FROM DRAWCURR
UNION ALL
SELECT Field1, Field2 FROM DRAWOLD


GO



then u can use this view to get the records, query is

select * from drawall
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

826 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question