473,421 Members | 1,525 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,421 software developers and data experts.

Link two tables using union

112 100+
Hi,
I have three tables its contains same kind of fields for different time periods. For the result i want to link the tables. can u tell me some examples.
Nov 22 '06 #1
9 11363
willakawill
1,646 1GB
Hi,
I have three tables its contains same kind of fields for different time periods. For the result i want to link the tables. can u tell me some examples.
Hi. If you would kindly post the table structures here we could do business :)
Nov 22 '06 #2
imtmub
112 100+
Hi. If you would kindly post the table structures here we could do business :)
My Table contains City, VenueId,VenueName, Industry, Address,DS,GW,ML, Total, Rn, FalioNo, Date, Status. ( All the three tables contains the same Field structure). Now i want make a link to get all the rows in one.
Nov 22 '06 #3
willakawill
1,646 1GB
My Table contains City, VenueId,VenueName, Industry, Address,DS,GW,ML, Total, Rn, FalioNo, Date, Status. ( All the three tables contains the same Field structure). Now i want make a link to get all the rows in one.
Expand|Select|Wrap|Line Numbers
  1. SELECT
  2. City, VenueId,VenueName, Industry, Address,DS,GW,ML, Total, Rn, FalioNo, Date, Status
  3. FROM TableA
  4. UNION
  5. SELECT
  6. City, VenueId,VenueName, Industry, Address,DS,GW,ML, Total, Rn, FalioNo, Date, Status
  7. FROM TableB
  8. UNION
  9. SELECT
  10. City, VenueId,VenueName, Industry, Address,DS,GW,ML, Total, Rn, FalioNo, Date, Status
  11. FROM TableB
  12. ORDER BY 1
  13.  
  14.  
Nov 22 '06 #4
imtmub
112 100+
Expand|Select|Wrap|Line Numbers
  1. SELECT
  2. City, VenueId,VenueName, Industry, Address,DS,GW,ML, Total, Rn, FalioNo, Date, Status
  3. FROM TableA
  4. UNION
  5. SELECT
  6. City, VenueId,VenueName, Industry, Address,DS,GW,ML, Total, Rn, FalioNo, Date, Status
  7. FROM TableB
  8. UNION
  9. SELECT
  10. City, VenueId,VenueName, Industry, Address,DS,GW,ML, Total, Rn, FalioNo, Date, Status
  11. FROM TableB
  12. ORDER BY 1
  13.  
  14.  
I m getting error when i m saving the view in sql. It showing the Error like "The Query Designer does not support the UNION SQL construct" I m using Sql Server2000.
Nov 22 '06 #5
willakawill
1,646 1GB
I m getting error when i m saving the view in sql. It showing the Error like "The Query Designer does not support the UNION SQL construct" I m using Sql Server2000.
Use the query analyser instead
Nov 22 '06 #6
imtmub
112 100+
Use the query analyser instead
In the Query Analyser its showing the result. Bu tin the Enterprise manager when i m trying to save the query its showing that "View Definition includes no output columns or includes no items in the FORM Clause"

Here my Code
SELECT *
FROM November
UNION ALL
SELECT *
FROM October;
First i m trying only two tables and its contains the same fields but time period is different. In the query analyser its giving result.
Nov 23 '06 #7
willakawill
1,646 1GB
In the Query Analyser its showing the result. Bu tin the Enterprise manager when i m trying to save the query its showing that "View Definition includes no output columns or includes no items in the FORM Clause"

Here my Code
SELECT *
FROM November
UNION ALL
SELECT *
FROM October;
First i m trying only two tables and its contains the same fields but time period is different. In the query analyser its giving result.
The enterprise manager does not recognise UNION. You can't use it for such a query.
Nov 23 '06 #8
imtmub
112 100+
The enterprise manager does not recognise UNION. You can't use it for such a query.
So how to link two tables in query.
Nov 23 '06 #9
willakawill
1,646 1GB
So how to link two tables in query.
The enterprise manager is not something that you would normally use for day to day processes. Design and analysis maybe.

SQL Sever recognises the UNION structure so you either run your query as a stored procedure or from another app such as vb or Access.
Nov 23 '06 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: VisionSet | last post by:
I have already posted this under 'Simple table organisation question' here is a more lucid version. It will be under MySQL v4.0 which now supports unions Consider 2 entities - books & authors...
2
by: Steve | last post by:
Hi; I am looking for suggestions about how to solve a problem using tsql. I have been asked to create a report concerning 4 tables. Each of the 4 tables is in its own database. The 4...
7
by: RLN | last post by:
Re: Access 2000 I have three history tables. Each table contains 3 years worth of data. All three tables have a date field in them (and autonum field). Each table has the potential to contain...
1
by: Eli Sidwell | last post by:
I have an Access DB that contains 5 tables for the last 5 years. All 5 tables have the same structure. I wanted to keep each year separate for organizational purposes. But, I want to query all 5...
5
by: Sami | last post by:
I can create queries and reports based on info from one table. How do I create one using information from multiple tables. What do I need to make sure the information from one table will be...
48
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer with table Students I am tasked to produce a...
6
by: John | last post by:
Hi I have three tables with a common id with which they can be linked. I need to merge them in a way that the resultant table has all records from three tables. Below is what sort of result I am...
1
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm...
3
by: Henrootje | last post by:
I have a lot of tables that hold a lot of numeric fields. The names of all of these tables start with ' tblRO' Now it turns out that all of the numeric fields with type double precision have the...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.