473,796 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Link two tables using union

112 New Member
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 11383
willakawill
1,646 Top Contributor
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 New Member
Hi. If you would kindly post the table structures here we could do business :)
My Table contains City, VenueId,VenueNa me, Industry, Address,DS,GW,M L, 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 Top Contributor
My Table contains City, VenueId,VenueNa me, Industry, Address,DS,GW,M L, 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 New Member
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 Top Contributor
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 New Member
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 Top Contributor
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 New Member
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 Top Contributor
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
1324
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 and their respective tables: book(id, title, author_id) author(id, name) Now consider another entity: review. Reviews can be of either books or
2
8969
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 tables are identical in name and structure.
7
3659
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 over 100K rows each. A common request the user receives is a request to pull all data written in a given month. I need to write some sort of union query across all three tables that would pull data for, say, only the month of December of all nine...
1
1804
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 tables with one query for an application. What would an query look like that uses all 5 tables as a source ? Should I create a view that inserts all 5 tables into a recordset ? (Wouldn't this be resource heavy ?)
5
38647
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 correctly assigned to specific person from another table? Thanks.
48
3881
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 query of all students in both tables with no duplicates. No clue whatsoever.
6
1970
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 expecting; Table 1 ID Value1 1 A1
1
9779
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 having I'd be most appreciative. The database is already constructed, I'm just wanting to export the data to an excel file. In short, I'm hoping to export two Tables (or queries...not sure which to use - they both seem to have the same data) in...
3
2472
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 property 'schaal' (<- dutch, the one above 'precision' ) set to zero. This should be '10' . Is there a way to change this through VBA? Using a loop or so? TIA Henro
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10239
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9057
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.