473,548 Members | 2,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compare 2 tables

I have 2 tables (tblSAPDetails & tblVendorDetail s) they both have
Vendor as the PK. I would like to run a query which would highligh the
differences between the 2 tables on 2 fields (ABC and Industry)

Eg:

TblSAPDetails:
Vendor ABC Industry
1004010 A MK

TblVendorDetail s:
Vendor ABC Industry
1004010 B MK

Should somehow return the difference between the 2 tables.

Can anyone point me in the right direction?

TIA

Nov 13 '05 #1
2 1556
et*******@bluey onder.co.uk wrote:
I have 2 tables (tblSAPDetails & tblVendorDetail s) they both have
Vendor as the PK. I would like to run a query which would highligh the
differences between the 2 tables on 2 fields (ABC and Industry)

Eg:

TblSAPDetails:
Vendor ABC Industry
1004010 A MK

TblVendorDetail s:
Vendor ABC Industry
1004010 B MK

Should somehow return the difference between the 2 tables.


Try concatonating the 3 fields for TblSAPDetails in one query and
concatonating the fields for TblVendorDetail s in another. If I'm
understanding you correctly, you could then include them in a third query
with an outer join on the concatonated fields and test for nulls.

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #2
Keith,
Why not do a calculated join on the two columns, for example:
SELECT VENDOR_OLD.NAME AS OLD_VENDOR_NAME , VENDOR_NEW.NAME AS
NEW_VENDOR_NAME
FROM tblSAPDetails as VENDOR_OLD, tblVendorDetail s AS VENDOR_NEW
WHERE VENDOR_OLD.ABC <> VENDOR_NEW.ABC
AND VENDOR_OLD.INDU STRY <> VENDOR_NEW.INDU STRY

This will give you anything that does not have a matching ABC and Industry.

"Keith" <ke*********@Aw ayWithYerCrap.c om> wrote in message
news:Xn******** *************** *@10.15.188.42. ..
et*******@bluey onder.co.uk wrote:
I have 2 tables (tblSAPDetails & tblVendorDetail s) they both have
Vendor as the PK. I would like to run a query which would highligh the
differences between the 2 tables on 2 fields (ABC and Industry)

Eg:

TblSAPDetails:
Vendor ABC Industry
1004010 A MK

TblVendorDetail s:
Vendor ABC Industry
1004010 B MK

Should somehow return the difference between the 2 tables.


Try concatonating the 3 fields for TblSAPDetails in one query and
concatonating the fields for TblVendorDetail s in another. If I'm
understanding you correctly, you could then include them in a third query
with an outer join on the concatonated fields and test for nulls.

Regards,
Keith.
www.keithwilby.com

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
52850
by: Maur | last post by:
Hi all, I have 2 tables say t_OLD and t_NEW. The new has corrections for audit purposes. They are identical in all respects (i.e. new is a copy of old and then changes are made to t_new) I would like a quick way to cycle through all the the fields in each table and compare the values to see if there are
5
10857
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the new database. For instance, her old database has a table with Band Info in it. Her new database also has a table with Band Info in it but slightly...
8
7122
by: Vincent | last post by:
has any one seen a program to compare mdbs'. I have ran into a few of them, but none seem to really do that job. Basically what I need to do is, take 2 access mdb's and check the differences between the 2. i am talking about tables, forms, queries, the whole ball of wax. Most of the programs jus do tables, that is the easy part. Also...
4
4976
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 recordset of appropriate fields (excluding memo and binary image fields) and dynamically loops through the fields' collection to perform the recordset...
9
6603
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 necessary, I can create the schema for the 3rd table (C) since it'll be exactly like table A. But I'm more interested in being able to store the resulting...
1
1876
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 the correct row in the 2nd DB I want to compare each field in the 2 tables to see if they match Every time i try and think how i end up with a while...
0
1807
by: Shaw | last post by:
Our database is constantly updated (input data) from another DB, and sometimes it crashes our ASP.NET applications. My boss told me to write a DB utility app to check DB and make sure all apps are still running. The first step of few checks is to compare current DB tables with yesterday’s tables. I store yesterday’s tables at a XML file...
17
4502
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are selected into 2 different SP variables and compared for equal. They are both NULL, but do not compare as equal. When the Not NULL columns (SALARY)...
5
2654
by: Edd E | last post by:
Hi, I have a database to store my analyses (Access 2002, WinXp), the basic structure is: TABLE 1 = Sample Info TABLE 2 = Analysis type 1 TABLE 3 = Analysis type 2 TABLE 4 = Analysis type 3 ....where each table stores results of a different type of analysis
5
3036
by: chazzy69 | last post by:
Ok heres what im trying to achive i am constantly updating the information in a table but know i what know if the data im replacing it with is new, i.e. whether or not i already had the data in the table. So my method for this is to first copy the information to be updated into another table (the 2nd table), then allow the information in the...
1
7467
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...
0
6039
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...
1
5367
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...
0
5085
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...
0
3497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1932
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
1
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.