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

Compare two Data tables

I have following data type in one table:

ID Company_Name
1 ABC
2 ABCD
.
.

I n other table i have values as in following table:

ID Company_Name Common_Name
1 ABC Inc
2 ABCD Ltd
1 ABC Corp.
2 ABCD LLc
.
.
.

What I need is to fill the "Common_Name in table 2 from value in table 1, and give the out put as:

ID Company_Name Common_Name
1 ABC Inc ABC
2 ABCD Ltd ABCD
1 ABC Corp. ABC
2 ABCD LLc ABC
.
.
.

Plz help me..

I don't have any idea of code writing.
Jun 2 '10 #1
1 1708
MMcCarthy
14,534 Expert Mod 8TB
OK your table structure is wrong.

Something like this would work.

tbl1
ID Company_Name
1 ABC
2 ABCD
.
.

I n other table i have values as in following table:
tbl2 - Common_Name shouldn't be here
ID Company_Name
1 ABC Inc
2 ABCD Ltd
1 ABC Corp.
2 ABCD LLc
Expand|Select|Wrap|Line Numbers
  1. SELECT tbl1.id, tbl2.Company_Name, tbl1.Company_Name As Common_Name
  2. FROM tbl1 INNER JOIN tbl2 ON tbl1.id=tbl2.id
This will give you the output you want but I'm not sure why you have these two table in the first place. There has to be a better way to structure your data.
Jun 2 '10 #2

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

Similar topics

10
by: xixi | last post by:
we are using db2 udb v8.1 on windows, i would like to know whether we have tool or way to compare two tables on same database for data difference. thanks. (same ddl, different data, try to compare...
1
by: Rachel Curran | last post by:
Please can anybody help me with the following: I have two separate excel spreadsheets that I have imported into access, each sheet holds the same fields. Both spreadsheets hold all information...
3
by: brian kaufmann | last post by:
Hi, I had sent this earlier, and would appreciate any suggestions on this. I need to make calculations for unemployment rate for three different data sources (A,B,C) for many countries and age...
0
by: dfs9 | last post by:
In the article "Delete Duplicate Records From Access Tables" By Danny Lesandrini writes the following: This final suggestion is the most flexible and accurate. Given any table, it generates a...
9
by: VMI | last post by:
I have two tables and I want to compare these two tables with a query( ie. "select * from A where B.key = A.key") and the result will be stored in a 3rd table (table C). is this possible? If...
1
by: Mark | last post by:
by m.r.davies I have 2 tables on seperate Db's (and servers) I want to use a datareader on the first table to pick the booking ref, and then use that booking ref to query the 2nd DB when i have...
1
by: Daves | last post by:
a SQL query can return multiple data tables eg SELECT expression1 ... SELECT expression2 ... Can I in ASP.Net utilise this to do fewer data fetches from the server, e.g. selectively binding...
1
by: Felix_WafyTech | last post by:
Hi, I'm working with the ObjectDatasource and the application is getting more and more chatty. Is there a way I could make the ObjectDatasource support multiple DataTables that could be...
11
by: khushbubhalla | last post by:
how to compare data between tables and views row by row , column by column in the test and production environment
1
by: Max2006 | last post by:
Hi, I am truing to find a pattern for my Business Logic Layer to be able to work fine win ObjectDataSource's Update method. The challenge is ObjectDataSource is not able to work with an...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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?
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...
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...

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.