473,396 Members | 1,792 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.

How do i append tables

1
I have got two tables
table 1 has data for year 2000 as follows
Company ID Units_jan Units_feb............Units_Dec
ABX 12 3 5 .............45
34 5 454 354354
................

table 2 has data for year 2001 as follows
Company ID Units_jan Units_feb............Units_Dec
AwX 12 3 5 .............45
34 5 454 354354
................
what i want is something like this

Company ID Units_jan Units_feb............Units_Dec Units_jan units feb
ABC 23

ABX 12 3 5 .............45

AwX 12



how do i do this???
Jun 4 '06 #1
3 1993
CaptainD
135 100+
First to answer your question if I read it right. With the example you give, just do a join on the company name since what you show does not appear to have a unique table ID number and no unique ID number to represent the company.
Expand|Select|Wrap|Line Numbers
  1. SELECT tTable1.sCompanyName, tTable1.Units_Jan01, tTable1.Units_Feb01, tTable2.Units_Jan02, tTable2.Units_Feb02
  2. FROM tTable1 INNER JOIN tTable2 ON tTable1.sCompanyName = tTable2.sCompanyName;
  3.  
Now, posting code(or examples). you can use "[" code "]" Write Code Here "[" /code "]" (remove the quotes around the "[" "]" brackets to desplay the code in the boxes you see here. makes it easier to read and you can cut and paste out of them.

As far as your table designs go, you need to look into what is called "normal Form" to design your tables correctly, it will make working with the databases a lot easier.
Jun 4 '06 #2
Owais
2
Captain u r quite right if the tables are normalized here. However i think that it would be jsut a simple query without join cuz in this way he will be able to get the data form both tables. If join condition is there then he will be getting only the common tuples from both tables. Just a clarification to your answer. I might be wrong here.
Jun 4 '06 #3
CaptainD
135 100+
Owais is correct, with what I showed you will only get results for from companies that made orders in both years.

For everything maybe this would work.

Expand|Select|Wrap|Line Numbers
  1. SELECT tTable1.sCompanyName, tTable1.Units_Jan01, tTable1.Units_Feb01, tTable1.sCompanyName, tTable2.Units_Jan02, tTable2.Units_Feb02
  2. FROM tTable1, tTable2;
  3.  
Jun 4 '06 #4

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

Similar topics

1
by: Girish | last post by:
I need to run a query which will pull data from two tables and append it as one when it displays the result. The data are in two tables. But the result set will be identical in terms of number of...
2
by: JMCN | last post by:
hi i need some advice on whether if it would be better to use an append query or an update query. here is the situation, i have linked another database table to my current database. then i...
2
by: Paul Wagstaff | last post by:
Hi there I have 2 tables: tblAccuracy & tblClearance Users add new records to tblAccuracy using frmRegister. Under specific conditions I need to append the current record from frmRegister into...
1
by: Peter D | last post by:
I have a database in ACCESS 97 and i have a routine that copies the tables to a database onto a floppy. What i would like is a routine to transfer the data from the floppy into the tables in a...
1
by: Kristina | last post by:
I'm trying to run multiple append queries in an Access front end that append data from tables in a .mdb into tables in SQL Server 2000. My Access front end has a link to both tables, the .mdb and...
5
by: Michael C via AccessMonster.com | last post by:
Hello, I have a table that I am appending 3 seperate tables into. My main problem is that each time I append the data, it simply adds to the data already there. That might sound ok, except that...
3
by: Dixie | last post by:
I know how to append records from one table to another in the same database, but I need to be able to append the records from all the tables in one database into new empty tables in another...
1
by: sparks | last post by:
I have 4 databases that are all the same thing. These are from different sites but we made sure that no 2 databases are using the same id's and autoid's so all the tables are unique in their data...
22
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
1
by: sparks | last post by:
We have 3 databases that are just copies of the master. I have no idea why this is but I need to put them all in one. They contain a main table and 2 subtables linked one to many. I am sure that...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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
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,...

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.